python - 从 Conda 环境运行时,PyDev/Eclipse 不加载 _mklinit

标签 python eclipse pydev conda

我创建了一个 conda 环境——testenv2——安装了 python/numpy/pandas。在 Eclipse 项目设置中将其添加为解释器,并使用它来运行我的测试 python 脚本。我收到以下错误。当我激活 conda 环境并在其中运行时,相同的测试脚本在命令行中运行良好。它也适用于 PyCharm。但不知何故无法在 Eclipse 中启动。

Traceback (most recent call last):
  File "C:\Data\projects\eclipse-workspace\PythonEclipse\Test.py", line 1, in <module>
    import numpy as np
  File "C:\Data\devtools\Anaconda3\envs\testenv2\lib\site-packages\numpy\__init__.py", line 140, in <module>
    from . import _distributor_init
  File "C:\Data\devtools\Anaconda3\envs\testenv2\lib\site-packages\numpy\_distributor_init.py", line 34, in <module>
    from . import _mklinit
ImportError: DLL load failed: The specified module could not be found.

如果我只是使用我的根 Conda Python 解释器运行相同的测试脚本,它工作正常。所以只有当我尝试使用我从 conda 创建的环境时。

感谢您的帮助!

最佳答案

CONDA_DLL_SEARCH_MODIFICATION_ENABLE=1 添加到您的环境变量。

对于 VSCode,工作区文件夹中的 .env 文件或 launch.json 中的 "env" 键应该可以解决问题。

来源:https://docs.conda.io/projects/conda/en/latest/user-guide/troubleshooting.html#numpy-mkl-library-load-failed

关于python - 从 Conda 环境运行时,PyDev/Eclipse 不加载 _mklinit,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54974444/

相关文章:

Python:使用 YAML 自动创建类方法

java - 无法在 Eclipse 上打开声明(未找到源)- HttpServlet.class

python - 如何使用 PyDev 调试 Django 单元测试?

eclipse - 是否可以设置在eclipse中默认运行哪个文件?

Python - 在 Tkinter 中使用绑定(bind)键移动输入光标

python - matplotlib 中没有填充的图像网格

java - AbstractUIPlugin 导致 NoClassDefFoundError

python - 在 Eclipse 中使用 Python 成像库 (PIL)

python - 如何将 numpy 数组保存到计算机中供以后在 python 中使用

java - Atmosphere 框架Spring mvc集成