使用带有 Anaconda 的 Sublime Text 的 Numpy ImportError

Numpy ImportError using Sublime Text with Anaconda

ImportError 尝试使用 Anaconda Distribution 在 Sublime Text3 中导入 numpy

我正在尝试使用 Anaconda Distribution 在 Sublime Text3 中导入 Numpy。我已经将我的构建系统设置为 Anaconda 的路径,Numpy 在所有 anaconda 的 IDE 包中运行良好。

Sublime 构建系统:

{
"path":"C:\Users\my_user\AppData\Local\Continuum\anaconda3\",
"shell_cmd": "python -u \"$file\"",
"file_regex": "^[]*File \"(...*?)\", line ([0-9]*)",
"selector": "source.python",

"variants":
[
    {
        "name": "Syntax Check",
        "shell_cmd": "python -m py_compile \"${file}\"",
    }
]
}
import numpy as np

ImportError: DLL load failed: The specified module can not be found.

I expect to import the module correctly, but shows the error:

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: No se puede encontrar el m�dulo especificado.

我的 Windows 10、SublimeText 3 64 位和 Anaconda3 64 位 运行 conda Sublime Text 包也有同样的问题。这是一个解决方法:

您可以尝试在 python 工作环境 (env) 中重新安装 numpy python 软件包。例如,如果您正在处理 mypython env,请打开 Anaconda 命令提示符并执行以下操作:

conda activate mypython

然后使用pip重新安装numpy:

pip install --upgrade --force-reinstall numpy

然后在 Sublime Text 中重试,应该没问题。

我遇到了完全相同的问题,我尝试了所有方法。

  • 不同的构建系统代码。
  • 修改系统路径。
  • 从 python.org
  • 安装 python
  • 重新安装 sublime text。
  • 甚至从奇怪的来源下载 DLL 文件。

最后只重新安装 anaconda 并重写 syspaths 解决了我的问题。