2017-07-03 3 views
0

Ich habe kürzlich versucht, das SpaCy-Modul für Python 3.x zu installieren. Die Installation sieht so aus, als ob sie erfolgreich ausgeführt wird (zeigt keine Fehler), aber wenn ich versuche, SpaCy zu importieren, oder wenn ich versuche, SpaCy-Modelle zu installieren, erhalte ich den Fehler unten. Ich habe versucht, spaCy mit pip install und conda install zu installieren, und ich habe versucht, eine Neuinstallation von numpy erzwingen.python - spaCy Modul wird nicht importiert

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. 
+1

Können Sie numpy ohne Probleme importieren? Wahrscheinlich nicht. Wenn nicht, wie haben Sie installiert? – Evert

+0

Ja, Sie haben Recht, ich konnte numpy nicht ohne Probleme importieren. Ich hatte nur versucht, eine Neuinstallation von numpy durch pip, aber ich habe gerade jetzt eine Installation von numpy durch Conda. Es scheint zu funktionieren, da ich jetzt sowohl numpy als auch spacy erfolgreich importieren kann. Danke für Ihre Hilfe! –

+0

Conda hat wahrscheinlich die erforderlichen DLL-Dateien hinzugefügt: externe Bibliotheken, auf die numpy angewiesen ist. pip geht nicht so weit: Es installiert keine externen Abhängigkeiten. Ich denke, dass Ihre ursprüngliche Conda-Installation von SpaCy fehlgeschlagen ist, weil es nur eine grundlegende Überprüfung für numpy, keine vollständige Überprüfung auf externe Abhängigkeiten durchführt, und da Ihre anzahlige Installation über pip war, fehlten genau diese Abhängigkeiten. – Evert

Antwort

0

diese 2 Ordner manuell entfernen:

rm -rf /usr/local/lib/python2.7/site-packages/numpy/ 
rm -rf /usr/local/lib/python2.7/site-packages/numpy-1.10.4.dist-info/ 

dann versuchen numpy zu installieren

pip install numpy 
Verwandte Themen