0
我最近試圖安裝python 3.x的spaCy模塊。安裝看起來像運行成功(顯示沒有錯誤),但是當我嘗試導入spaCy時,或者當我嘗試安裝spaCy模型時,出現下面的錯誤。我曾嘗試使用pip install
和conda install
安裝spaCy,並試圖強制重新安裝numpy。python - spaCy模塊不會導入
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\numpy\core\__init__.py",
line 16, in <module>
from . import multiarray
ImportError: DLL load failed: The specified procedure could not be found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\runpy.py", line 183, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File "C:\ProgramData\Anaconda3\lib\runpy.py", line 142, in _get_module_details
return _get_module_details(pkg_main_name, error)
File "C:\ProgramData\Anaconda3\lib\runpy.py", line 109, in _get_module_details
__import__(pkg_name)
File "C:\ProgramData\Anaconda3\lib\site-packages\spacy\__init__.py", line 5, in <module>
from .deprecated import resolve_model_name
File "C:\ProgramData\Anaconda3\lib\site-packages\spacy\deprecated.py", line 8, in <module>
from .cli import download
File "C:\ProgramData\Anaconda3\lib\site-packages\spacy\cli\__init__.py", line 5, in <module>
from .train import train, train_config
File "C:\ProgramData\Anaconda3\lib\site-packages\spacy\cli\train.py", line 8, in <module>
from ..scorer import Scorer
File "C:\ProgramData\Anaconda3\lib\site-packages\spacy\scorer.py", line 4, in <module>
from .gold import tags_to_entities
File "spacy/morphology.pxd", line 25, in init spacy.gold (spacy/gold.cpp:23505)
cdef class Morphology:
File "spacy/vocab.pxd", line 27, in init spacy.morphology (spacy/morphology.cpp:10713)
cdef class Vocab:
File ".env/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd", line 155, in init spacy.vocab (spacy/vocab
.cpp:19463)
File "C:\ProgramData\Anaconda3\lib\site-packages\numpy\__init__.py", line 142, in <module>
from . import add_newdocs
File "C:\ProgramData\Anaconda3\lib\site-packages\numpy\add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "C:\ProgramData\Anaconda3\lib\site-packages\numpy\lib\__init__.py", line 8, in <module>
from .type_check import *
File "C:\ProgramData\Anaconda3\lib\site-packages\numpy\lib\type_check.py", line 11, in <module>
import numpy.core.numeric as _nx
File "C:\ProgramData\Anaconda3\lib\site-packages\numpy\core\__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.
可以導入numpy的沒有問題?可能不會。如果沒有,你怎麼安裝numpy? – Evert
是的,你是對的,我沒有能夠導入numpy沒有問題。我只嘗試通過pip強制重新安裝numpy,但我現在只是通過conda運行numpy的安裝。它似乎工作,因爲我現在可以成功導入numpy和spaCy。謝謝你的幫助! –
Conda可能添加了所需的DLL文件:numpy依賴的外部庫。點子不會那麼遠:它不會安裝外部依賴。我認爲你原來的conda安裝spaCy失敗了,因爲它只做了numpy的基本檢查,而不是對外部依賴的完整檢查,並且由於你的numpy安裝是通過pip,所以它恰好缺少了這些依賴關係。 – Evert