我在Amazon EC2上使用Linux AMI,我想安装numpy
和scipy
。从理论上讲,它应该是非常简单的,但我会遇到问题。
以下是我的步骤:
> sudo alternatives --set python /usr/bin/python3.4
> sudo virtualenv -p python3.4 my_env
> sudo chmod -R 777 my_env
> . my_env/bin/activate
> pip install numpy
安装numpy
会返回:
Collecting numpy
Using cached numpy-1.10.1.tar.gz
Installing collected packages: numpy
Running setup.py install for numpy
Successfully installed numpy
但它似乎不起作用,因为运行pip freeze
和pip list
并未显示numpy
的任何痕迹。当我尝试运行pip install scipy
:
Collecting scipy
Using cached scipy-0.16.1.tar.gz
Collecting numpy>=1.6.2 (from scipy)
Using cached numpy-1.10.1.tar.gz
Installing collected packages: numpy, scipy
Running setup.py install for numpy
ImportError: No module named 'numpy' Running setup.py install for scipy
Complete output from command /usr/lib/python3.4/my_env/bin/python3.4 -c "import setuptools, tokenize;__file__='/tmp/pip-build-wq1cn43p/scipy/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-mjftl3bs-record/install-record.txt --single-version-externally-managed --compile --install-headers /usr/lib/python3.4/my_env/include/site/python3.4/scipy:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-wq1cn43p/scipy/setup.py", line 253, in <module>
setup_package()
File "/tmp/pip-build-wq1cn43p/scipy/setup.py", line 241, in setup_package
from numpy.distutils.core import setup
ImportError: No module named 'numpy'
我有最新的点子版本7.1.2。
答案 0 :(得分:2)
当你设置virtualenv使用python3时,你还必须使用pip3
virtualenv -p python3.4 env
source env/bin/activate
pip3 install numpy