问题
I have installed numpy using the cygwin setup, and it is showing as successfully installed. But I am not able to import it in my program.
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
I checked and found that both lapack_lite.dll
and _umath_linalg.dll
are available under /lib/python2.7/site-packages/numpy/linalg
When I try to reinstall numpy, I get the following message:
$ pip install numpy
Requirement already satisfied: numpy in /usr/lib/python2.7/site-packages
The package is also up-to-date.
$ pip install numpy --upgrade
Requirement already up-to-date: numpy in /usr/lib/python2.7/site-packages
How do I import numpy in my programs?
回答1:
I simply restarted my system and the error went away!
来源:https://stackoverflow.com/questions/42320132/not-able-to-import-numpy-in-cygwin