【问题标题】:PyCharm can't find module which is installedPyCharm 找不到已安装的模块
【发布时间】:2019-01-18 18:34:20
【问题描述】:

我正在尝试在 PyCharm 中使用 numpy,在 Spyder 中它确实有效,但是使用 PyCharm 我遇到了麻烦。

import numpy

a = [ 1, 2, 3, 4]

numpy.savetxt("geht das jetzt.txt", a)

PyCharm 建议使用 numpy,但是当我尝试运行代码时出现以下错误:

ImportError: 
Importing the multiarray numpy extension module failed.
Most likely you are trying to import a failed build of numpy.
If you're working with a numpy git repo, try `git clean -xdf` (removes all
files not under version control).  Otherwise reinstall numpy.

Original error was: DLL load failed: Das angegebene Modul wurde nicht gefunden.

我已经尝试过这个:Libraries work fine in Spyder but not in PyCharm 但没有成功。

【问题讨论】:

  • 转到File > Settings > Project > Project interpreter。在那里你应该看到你工作环境中安装的所有包的列表。你能在这个列表中看到Numpy吗?如果是,请注明 Numpy 的版本以及您使用的 Python 版本。没有这些信息就很难提供帮助。
  • 谢谢,我已经试过了,还是不行。 Allthough我真的不明白问题是什么,我找到了解决方案。再次安装 Numpy(使用 pip 而不是 pycharm 或 conda)确实有效。
  • @Eskapp 暗示的解释器之间一定存在不匹配。

标签: python-3.x pycharm anaconda


【解决方案1】:

虽然我并不真正了解问题所在,但我找到了解决方案。再次安装 Numpy(使用 pip 而不是 pycharm 或 conda)确实有效。

【讨论】: