Как установить numpy на Python 2.7 в virtualenv?
Я пытаюсь установить numpy
на Python 2.7
в virtualenv
(на Cygwin).
Тем не менее, когда я пытаюсь import numpy
Я получаю ImportError
:
Administrator@Ron ~/python/virtualenv
$ virtualenv -p /usr/bin/python2.7.exe machine_learning
Running virtualenv with interpreter /usr/bin/python2.7.exe
New python executable in /home/Administrator/python/virtualenv/machine_learning/bin/python2.7
Also creating executable in /home/Administrator/python/virtualenv/machine_learning/bin/python
Installing setuptools, pip, wheel...done.
Administrator@Ron ~/python/virtualenv
$ source machine_learning/bin/activate
(machine_learning)
Administrator@Ron ~/python/virtualenv
$ pip2 install numpy
Collecting numpy
Installing collected packages: numpy
Successfully installed numpy-1.13.0
(machine_learning)
Administrator@Ron ~/python/virtualenv
$ python2 -c "import numpy"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/Administrator/python/virtualenv/machine_learning/lib/python2.7/site-packages/numpy/__init__.py", line 142, in <module>
from . import add_newdocs
File "/home/Administrator/python/virtualenv/machine_learning/lib/python2.7/site-packages/numpy/add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "/home/Administrator/python/virtualenv/machine_learning/lib/python2.7/site-packages/numpy/lib/__init__.py", line 19, in <module>
from .polynomial import *
File "/home/Administrator/python/virtualenv/machine_learning/lib/python2.7/site-packages/numpy/lib/polynomial.py", line 20, in <module>
from numpy.linalg import eigvals, lstsq, inv
File "/home/Administrator/python/virtualenv/machine_learning/lib/python2.7/site-packages/numpy/linalg/__init__.py", line 51, in <module>
from .linalg import *
File "/home/Administrator/python/virtualenv/machine_learning/lib/python2.7/site-packages/numpy/linalg/linalg.py", line 30, in <module>
from numpy.linalg import lapack_lite, _umath_linalg
ImportError: No such file or directory
(machine_learning)
Administrator@Ron ~/python/virtualenv
Любое предложение, как установить Numpy на Python 2.7 в virtualenv?
Замечания:
Python3 Cygwin версии 3.6, и кажется, что Pypi Numpy еще не готов для 3.6.
Изменить 1:
В ответ на комментарий matzeri я удалил numpy
из pip3 и pip2, и установлен numpy
для Python 3 и Python 2 из файла setup.exe Cygwin.
Ниже приведены ошибки, которые я получаю для numpy, когда пытаюсь импортировать его впоследствии:
$ python3 -c "import numpy"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/lib/python3.6/site-packages/numpy/__init__.py", line 142, in <module>
from . import add_newdocs
File "/usr/lib/python3.6/site-packages/numpy/add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "/usr/lib/python3.6/site-packages/numpy/lib/__init__.py", line 18, in <module>
from .polynomial import *
File "/usr/lib/python3.6/site-packages/numpy/lib/polynomial.py", line 20, in <module>
from numpy.linalg import eigvals, lstsq, inv
File "/usr/lib/python3.6/site-packages/numpy/linalg/__init__.py", line 51, in <module>
from .linalg import *
File "/usr/lib/python3.6/site-packages/numpy/linalg/linalg.py", line 29, in <module>
from numpy.linalg import lapack_lite, _umath_linalg
ImportError: No such file or directory
$ python2 -c "import numpy"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/lib/python2.7/site-packages/numpy/__init__.py", line 142, 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 20, 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
1 ответ
Установить пакет python2-numpy
с настройкой Cygwin. Вам не нужно pip, чтобы установить его.
python2 -c "import numpy"
работает для меня.
Как проблема кажется на lapack_lite
проверьте, что у вас есть /usr/lib/lapack/
на вашем пути.
$ cygcheck -l liblapack0
/etc/profile.d/lapack0.csh
/etc/profile.d/lapack0.sh
/usr/lib/lapack/cygblas-0.dll
/usr/lib/lapack/cyglapack-0.dll
$ cygcheck /usr/lib/python2.7/site-packages/numpy/linalg/lapack_lite.dll | grep -v Windows
E:\cygwin64\lib\python2.7\site-packages\numpy\linalg\lapack_lite.dll
E:\cygwin64\bin\cygwin1.dll
E:\cygwin64\lib\lapack\cyglapack-0.dll
E:\cygwin64\bin\cyggcc_s-seh-1.dll
E:\cygwin64\bin\cyggfortran-3.dll
E:\cygwin64\bin\cygquadmath-0.dll
E:\cygwin64\bin\cygblas-0.dll
E:\cygwin64\bin\libpython2.7.dll
В противном случае библиотека lapack не будет работать.