ImportError:导入字符串时DLL加载失败:找不到指定的模块



我正试图在spaCy中加载一个语言模型,但当我尝试在旧命令和新命令中安装该模型时,都会遇到错误。

通过旧版缩写安装:

python -m spacy download en
Traceback (most recent call last):
File "C:UsersmikkelsonAppDataLocalProgramsPythonPython39librunpy.py", line 188, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File "C:UsersmikkelsonAppDataLocalProgramsPythonPython39librunpy.py", line 147, in _get_module_details
return _get_module_details(pkg_main_name, error)
File "C:UsersmikkelsonAppDataLocalProgramsPythonPython39librunpy.py", line 111, in _get_module_details
__import__(pkg_name)
File "C:UsersmikkelsonAppDataLocalProgramsPythonPython39libsite-packagesspacy__init__.py", line 13, in <module>
from . import pipeline  # noqa: F401
File "C:UsersmikkelsonAppDataLocalProgramsPythonPython39libsite-packagesspacypipeline__init__.py", line 1, in <module>
from .attributeruler import AttributeRuler
File "C:UsersmikkelsonAppDataLocalProgramsPythonPython39libsite-packagesspacypipelineattributeruler.py", line 6, in <module>
from .pipe import Pipe
File "spacypipelinepipe.pyx", line 1, in init spacy.pipeline.pipe
ImportError: DLL load failed while importing strings: The specified module could not be found.

使用更新的全名安装:

python -m spacy download en_core_web_sm
Traceback (most recent call last):
File "C:UsersmikkelsonAppDataLocalProgramsPythonPython39librunpy.py", line 188, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File "C:UsersmikkelsonAppDataLocalProgramsPythonPython39librunpy.py", line 147, in _get_module_details
return _get_module_details(pkg_main_name, error)
File "C:UsersmikkelsonAppDataLocalProgramsPythonPython39librunpy.py", line 111, in _get_module_details
__import__(pkg_name)
File "C:UsersmikkelsonAppDataLocalProgramsPythonPython39libsite-packagesspacy__init__.py", line 13, in <module>
from . import pipeline  # noqa: F401
File "C:UsersmikkelsonAppDataLocalProgramsPythonPython39libsite-packagesspacypipeline__init__.py", line 1, in <module>
from .attributeruler import AttributeRuler
File "C:UsersmikkelsonAppDataLocalProgramsPythonPython39libsite-packagesspacypipelineattributeruler.py", line 6, in <module>
from .pipe import Pipe
File "spacypipelinepipe.pyx", line 1, in init spacy.pipeline.pipe
ImportError: DLL load failed while importing strings: The specified module could not be found.

Python 3.9是通过anaconda安装的,spaCy v3.0.6是通过pip安装的,我在Windows环境中。我该怎么解决这个问题?

一直面临同样的问题,被告知问题来自python3.9,所以我用3.8进行了测试,但这并没有帮助,但安装以下Visual C++Redistributable解决了我的问题https://www.microsoft.com/en-in/download/details.aspx?id=48145

我希望这能有所帮助!

该问题与您尝试下载模型的特定方式无关,而是与加载DLL(pipe.pyx(的问题有关,该DLL很可能依赖于您丢失的VS构建工具(请参阅此处的详细信息(。

一旦安装了这个依赖项,它就应该开始工作了。

最新更新