【发布时间】:2014-09-24 22:49:08
【问题描述】:
我正在尝试在我的工作 Mac(OSX Mavericks)上安装 python 包 scipy。我有 sudo 权限并安装了 macports、pip 和 homebrew,但无法将 scipy 导入 python。尝试导入时出现以下错误:
导入 scipy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named scipy
尝试 sudo port install scipy 时:
错误:找不到端口 scipy
尝试 sudo port install py27-scipy:
Computing dependencies for py27-scipy
Cleaning py27-scipy
Updating database of binaries
Scanning binaries for linking errors
No broken files found.
但仍然无法将 scipy 导入 python。
使用 sudo pip install scipy 给我这个:
Downloading/unpacking scipy
Cannot fetch index base URL https://pypi.python.org/simple/
Could not find any downloads that satisfy the requirement scipy
Cleaning up...
No distributions at all found for scipy
Storing debug log for failure in /Users/philip/.pip/pip.log
所以我很茫然,不知道这是怎么回事
【问题讨论】:
-
做一件事。从here(zip 或 tar.gz)下载源代码。提取它们,进入提取的目录并运行
python setup.py install。如果它抛出任何错误。将它们发布在此处以进行进一步调试。 -
我下载了 tar.gz 文件,运行了设置,仍然得到相同的“ImportError: No module named scipy”
-
然后检查
PATH环境变量。这似乎是这里的罪魁祸首。还是您已经安装了numpy?即使这样也不会引起什么问题 -
我安装了 numpy,它可以很好地导入并且可以正常工作。不知道为什么会导致问题。我当前的 PATH 设置为具有 scipy 的 anaconda python。现在 pyside 不工作了讽刺耶
-
下载这个-[gist.github.com/goldsmith/7262122/download]并在你的系统中运行它。
标签: python macos python-2.7 scipy