python - 关于从 PyCharm 安装 SciPy

标签 python python-2.7 scipy pycharm

我一直在尝试在 Windows 7 上的 PyCharm 中安装 SciPy。但安装过程失败并显示以下错误消息。

Enter image description here

然后我按照 install Python package with .whl file 中列出的步骤进行操作,

pip install wheel
pip install some-package.whl

安装过程成功。但是,我仍然无法从 PyCharm 中找到 SciPy 包。

Enter image description here

最佳答案

如果您在 Windows 7 上安装 SciPy 时解决了 NumPy/wheel 问题,那么这是一个相对快速的修复方法。简而言之,您需要添加 SciPy 所在的路径(距离 Python 仅几个子文件夹)。您可以在 PyCharm 中看到添加路径的一般摘要 here .

打开一个 Python 解释器,您可以在其中打开 SciPy。

>> import scipy
>> scipy.__file__
"path/to/scipy"

这是我的路径:

C:\Users\ME\AppData\Local\Continuum\Anaconda3\Lib\site-packages\scipy

因此,SciPy 安装在 Continuum 中,而 Python 位于其自己的目录中。 PyCharm 中的默认解释器路径在 Python 目录中查找,如下所示:

file://C:/Users/ME/AppData/Local/Programs/Python/Python35/DLLs
file://C:/Users/ME/AppData/Local/Programs/Python/Python35/Lib
file://C:/Users/ME/AppData/Local/Programs/Python/Python35
file://C:/Users/ME/AppData/Local/Programs/Python/Python35/Lib/site-packages
file://C:/Users/ME/AppData/Local/Programs/Python/Python35/Lib/site-packages/win32
file://C:/Users/ME/AppData/Local/Programs/Python/Python35/Lib/site-packages/win32/lib
file://C:/Users/ME/AppData/Local/Programs/Python/Python35/Lib/site-packages/pythonwin

要解决此问题,请打开 PyCharm 并前往菜单文件设置项目解释器。打开ProjectInterprets,右侧有一个标有“show paths”的小按钮。我将我的路径添加到 SciPy:

file://C:/Users/ME/AppData/Local/Continuum/Anaconda3/Lib/site-packages/

继续在这里添加你的路径,你应该可以开始了!

关于python - 关于从 PyCharm 安装 SciPy,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28663601/

相关文章:

python - 如何使数据框中的列唯一?

python - 在 Python 中读取和切片二进制数据文件的最快方法

python - 更改终端和 IntelliJ 中的 python 版本

python - 我可以相信 R 中 `nloptr` 的结果吗?

python - 当决胜局随机时在 python 中排名

python - 如何在使用 ax.axis ('equal' 时强制执行 xlim 和 ylim )?

python - 如何在类似于点积的 numpy 中获得 "dot addition"?

python - np.loadtxt 用于包含多个矩阵的文件

python - 如何在 Mac OS X 10.6.4 上卸载 Python 2.7?

python - 使用 matplotlib.pyplot.plot_date 绘制多数据集