【发布时间】:2012-07-17 06:35:21
【问题描述】:
我刚刚使用自制软件和 pip 安装了 scipy 和 numpy。我做了以下事情:
brew install python
brew install gfortran
easy_install pip
sudo pip install numpy
sudo pip install scipy
numpy 和 scipy 都可以在 /Library/Python/2.7/site-packages 中轻松找到,但是当我在终端中打开 python shell 并输入:
import numpy
import scipy
我明白了:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named numpy
scipy 也是如此。怎么了? Pip 似乎认为它们已安装。
【问题讨论】:
-
您确定您使用的python与安装了numpy和scipy的python相同吗?
-
用自制软件安装 python 后,它会告诉你添加一些路径到你的
PATH和PYTHONPATH。如果你不这样做,easy_install和pip将是系统 python 的,而不是自制软件的。numpy和scipy应该安装在/usr/local/... 以便 homebrew 的 python 找到它。
标签: python numpy matplotlib scipy homebrew