本文介绍了使用 conda 从 Anaconda 导入 numpy 时出错(DLL 加载失败:找不到指定的模块)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用 Anaconda 时,导入 numpy 会出现以下错误:

When I use Anaconda, importing numpy gives me the following error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File"C:Userss140041Anaconda3envs	estenvlibsite-packages
umpy\__init__.py", line 142, in <module>
    from . import add_newdocs
  File"C:Userss140041Anaconda3envs	estenvlibsite-packages
umpyadd_newdocs.py", line 13, in <module>
    from numpy.lib import add_newdoc
  File "C:Userss140041Anaconda3envs	estenvlibsite-packages
umpylib\__init__.py", line 8, in <module>
    from .type_check import *
  File"C:Userss140041Anaconda3envs	estenvlibsite-packages
umpylib	ype_check.py", line 11, in <module>
    import numpy.core.numeric as _nx
  File"C:Userss140041Anaconda3envs	estenvlibsite-packages
umpycore\__init__.py", line 26, in <module>
    raise ImportError(msg)

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: The specified module could not be found.

我已经做了很多故障排除:

I have already done a LOT of troubleshooting:

  • 我认为这个问题与路径无关,因为 Anaconda 是我在这台机器上唯一安装的 python,并且在全新安装 windows 后问题仍然存在.我现在还没有将 anaconda 添加到 Path,因为我只是使用 Anaconda 提示符来处理所有与 conda 相关的命令.

  • I do not think the issue is path-related, Since Anaconda is my only installation of python on this machine, and the problem persists after a fresh installation of windows. I have not added anaconda to Path right now, since I just use the Anaconda prompt for all my conda related commands.

我不认为这是环境的问题,conda 的基础/根环境以及新的 conda 环境都存在问题.

I do not think it is a problem with the environments, Problem exists on base/root environment of conda as well as on a new conda environment.

只有当我使用 conda 卸载并使用 pip 重新安装时,一切正常... 我在这里做错了什么,还是在这个 Anaconda 安装中 conda 损坏了?

Only when I uninstall using conda and re-install using pip everything works fine... Am i doing something wrong here, or is conda broken in this installation of Anaconda?

我刚刚从普通的python/venv/pip切换到Anaconda/conda/environments,但我必须说这并不是一个真正的热烈欢迎......尽管我听说conda打包系统比pip/venv好.

I just switched from a normal python/venv/pip to Anaconda/conda/environments, but I must say this is not really a warm welcome... Even though I heard that the conda packagement system is better than pip/venv.

更新:我在 github 上提交了一个错误报告,可以在这里找到.https://github.com/conda/conda/issues/7833

UPDATE:I filed a bug report on github, which can be found here.https://github.com/conda/conda/issues/7833

推荐答案

可以在 GitHub 上的错误报告中找到关于问题的非常清晰的讨论:

Very clear discussion of what went wrong can be found in the bug-report on GitHub:

https://github.com/conda/conda/issues/7833

总结,不支持在未激活的环境中使用 PyCharm.因此,要么使用 anaconda 提示符,激活您的环境并从那里启动 PyCharm,要么重新安装 anaconda/mini-conda 并选中添加到路径"选项

Summarized, using PyCharm with an unactivated environment is unsupported. So either use anaconda prompt, activate your environment and launch PyCharm from there, or re-install anaconda/mini-conda with the option "add-to-path" checked

这篇关于使用 conda 从 Anaconda 导入 numpy 时出错(DLL 加载失败:找不到指定的模块)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-25 22:42