Wie installiere ich numpy auf Python 2.7 in virtualenv?

917
boardrider

Ich versuche zu installieren numpyauf Python 2.7in virtualenv(auf Cygwin).
Wenn ich es versuche import numpy, bekomme ich jedoch 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 

Gibt es einen Vorschlag, wie Sie numpy auf Python 2.7 in virtualenv installieren können?

Hinweis:
Cygwins Python3-Version ist 3.6, und es scheint, dass Pypi Numpy's noch nicht für 3.6 bereit ist.

Edit 1:

In Antwort auf matzeri ‚s Kommentar, deinstallierte ich numpyvon PIP3 und pip2 und installierte numpyfür Python 3 und Python 2 von Cygwin der setup.exe.
Folgende Fehler bekomme ich für numpy, wenn ich versuche, es später zu importieren:

$ 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 
0

1 Antwort auf die Frage

0
matzeri

Install the package python2-numpy with cygwin setup. You don't need pip to install it.

python2 -c "import numpy" works for me.
As the issue seems on lapack_lite check that you have /usr/lib/lapack/ on your path.

$ 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 

Otherwise the lapack library will not be operative.

Leider habe ich die Installation mit PIP versucht, nachdem beim Installieren des von Ihnen vorgeschlagenen Pakets Fehler aufgetreten sind. boardrider vor 7 Jahren 0
Welche Fehler hatten Sie mit python2-numpy? matzeri vor 7 Jahren 0
Als Antwort auf Ihre Frage habe ich _Edit 1_ zum OP hinzugefügt. boardrider vor 7 Jahren 0