2013-08-17 22 views
4

我是新手編程並試圖導入scipy。使用macports安裝scipy時遇到問題

問題:

當我嘗試在終端Python解釋器導入SciPy的,它看起來像這樣:

[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on darwin 
Type "help", "copyright", "credits" or "license" for more information. 
>>> import scipy 
Traceback (most recent call last): 
    File "<stdin>", line 1, in <module> 
ImportError: No module named scipy 
>>> 

我似乎已經正確安裝使用MacPorts。我可以像上面一樣成功導入numpy。

我原先安裝SciPy的按 「MacPorts的」 說明書上http://www.scipy.org/install.html

即:

sudo port install py27-numpy py27-scipy py27-matplotlib py27-ipython +notebook py27-pandas py27-sympy py27-nose 

我也跟着這個帖子: Python will not recognize MacPorts installed packages

但也似乎沒有得到一個答案我自己

澄清:

當我跑我得到

/usr/bin/python 

「的蟒蛇」 當我運行 「端口內容py27,軟件包名」 我得到提前

Port py27-packagename is not installed. 

感謝

回答

12

MacPorts的不安裝python模塊時觸摸系統python。它確實爲它自己的python版本安裝了這些模塊,默認情況下它的版本號爲/opt/local/bin/python2.7。當您在shell中使用sudo port select --set python python27鍵入python時,可以將其設置爲運行的默認python。