【发布时间】:2020-03-14 05:13:08
【问题描述】:
我正在使用 miniconda。 Spyder 安装在基础环境中,并配置了 spyder_kernels 以指向我工作环境中名为 py37 的解释器。那是安装 numpy、pandas 和 matplotlib 的地方。
当我在命令提示符下激活 py37 并在那里使用 python 时,我可以在我的脚本中使用 matplotlib 而不会发生意外。
当我尝试从 spyder 运行相同的脚本时,我得到这个 DLL 导入错误:
File "C:\Users\eli\miniconda3\envs\py37\lib\site-packages\matplotlib\__init__.py", line 190, in _check_versions
from . import ft2font
ImportError: DLL load failed: The specified module could not be found.
谁能告诉我如何进一步诊断这个问题?似乎它正在尝试从正确的环境中导入。 import numpy 和 import pandas 可以工作(两者都只安装在 py37 中,而不是 base 中)。这是来自基础环境的某种干扰吗?我知道我可以在 py37 环境中安装 spyder,但我喜欢 spyder-kernels 的想法,因为它可以让工作环境更简单......如果我能让它工作的话。
【问题讨论】:
-
标签应该是
matplotlib,而不是numpy,对吧?现在,如果我没记错的话,我在ft2font导入时遇到了类似的问题(分别称为dll)。我不是 100% 确定,但我认为从 Christoph Gohlke's whl files 安装matplotlib为我解决了这个问题,因为这与某些特定于操作系统的dlls有关(适用于 Linux 而非 Windows 之类的东西)。我必须说虽然我没有使用conda/miniconda,所以我不知道这是否适合你。 -
是的,没错。
标签: matplotlib virtualenv python-import spyder