Я пытаюсь установить 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?
Примечание: версия Cygwin's Python3 - 3.6, и кажется, что pypi numpy's еще не готова для 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 ответ на вопрос
0
matzeri
Установите пакет python2-numpyс установкой cygwin. Вам не нужно pip, чтобы установить его.
python2 -c "import numpy"работает для меня. Поскольку проблема кажется на lapack_liteпроверке, что у вас есть /usr/lib/lapack/на вашем пути.