2015-12-02 319 views
0

我在Amazon EC2上使用Linux AMI,我想安裝numpyscipy。從理論上講,它應該很直接,但我遇到了問題。pip安裝numpy - 無法安裝,雖然沒有錯誤

這裏是我的步驟:

> 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 freezepip 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。

回答

2

當您設置的virtualenv使用python3你也可以選擇使用pip3

virtualenv -p python3.4 env 
source env/bin/activate 
pip3 install numpy 
+0

啊,我不知道這個連接。 其實我在嘗試使用pip3時遇到了同樣的錯誤。但知道這一點,並知道我不必使用3.4,我選擇了Python 2.7和點子。現在一切按預期安裝。 – Joshua

+0

仍然有點奇怪,它應該與pip3一起使用。當我回家時我可以測試它 – Altoyyr