我已经使用cygwin安装程序安装了numpy,它显示为已成功安装。但我无法在我的程序中导入它。
Traceback (most recent call last):
File "pythonpath.py", line 1, in <module>
import numpy
File "/usr/lib/python2.7/site-packages/numpy/__init__.py", line 170, in <module>
from . import add_newdocs
File "/usr/lib/python2.7/site-packages/numpy/add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "/usr/lib/python2.7/site-packages/numpy/lib/__init__.py", line 18, in <module>
from .polynomial import *
File "/usr/lib/python2.7/site-packages/numpy/lib/polynomial.py", line 19, in <module>
from numpy.linalg import eigvals, lstsq, inv
File "/usr/lib/python2.7/site-packages/numpy/linalg/__init__.py", line 51, in <module>
from .linalg import *
File "/usr/lib/python2.7/site-packages/numpy/linalg/linalg.py", line 29, in <module>
from numpy.linalg import lapack_lite, _umath_linalg
ImportError: No such file or directory
我查了一下,发现lapack_lite.dll
_umath_linalg.dll
和/lib/python2.7/site-packages/numpy/linalg
都可用
当我尝试重新安装numpy时,我收到以下消息:
$ pip install numpy
Requirement already satisfied: numpy in /usr/lib/python2.7/site-packages
该套餐也是最新的。
$ pip install numpy --upgrade
Requirement already up-to-date: numpy in /usr/lib/python2.7/site-packages
如何在我的程序中导入numpy?
答案 0 :(得分:0)
我只是重新启动了系统,错误就消失了!
答案 1 :(得分:0)
我现在在 Python 3.8 中遇到了同样的情况。不幸的是,重新启动并没有帮助。但我找到了解决方案:
# cygcheck /usr/lib/python3.8/site-packages/numpy/linalg/lapack_lite.cpython-38-x86_64-cygwin.dll
--> cygcheck: track_down: 找不到 cyglapack-0.dll
解决方案:
# cp /usr/lib/lapack/cyglapack-0.dll /bin
之后在/bin中找到cyglapack-0.dll,因为它在PATH中。