2017-07-05 111 views
0

我已經安裝了python 3.6並通過pip添加了numpy模塊,但在嘗試導入庫時出現錯誤。請在這裏幫助:無法在Python中導入numpy庫

>>> import numpy 
Traceback (most recent call last): 
    File "C:\Users\as338011\AppData\Local\Programs\Python\Python36\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. 

在處理上述異常,另一個異常:

Traceback (most recent call last): 
    File "<stdin>", line 1, in <module> 
    File "C:\Users\as338011\AppData\Local\Programs\Python\Python36\lib\site-packages\numpy\__init__.py", line 142, in <mod 
ule> 
    from . import add_newdocs 
    File "C:\Users\as338011\AppData\Local\Programs\Python\Python36\lib\site-packages\numpy\add_newdocs.py", line 13, in <m 
odule> 
    from numpy.lib import add_newdoc 
    File "C:\Users\as338011\AppData\Local\Programs\Python\Python36\lib\site-packages\numpy\lib\__init__.py", line 8, in <m 
odule> 
    from .type_check import * 
    File "C:\Users\as338011\AppData\Local\Programs\Python\Python36\lib\site-packages\numpy\lib\type_check.py", line 11, in 
<module> 
    import numpy.core.numeric as _nx 
    File "C:\Users\as338011\AppData\Local\Programs\Python\Python36\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. 

原來的錯誤是:DLL加載失敗:指定的程序無法找到。

+1

你試過卸載然後重新安裝numpy嗎? – DavidG

+0

我試過多次通過pip重新安裝,而嘗試用pip3我得到以下錯誤: 'PS E:\機器學習分類器> python pip3安裝numpy C:\ Users \ as338011 \ AppData \ Local \ Programs \ Python \ Python36 \ python.exe:無法打開文件'pip3':[Errno 2]沒有這樣的文件或目錄' – Ashutosh

回答

0

正如您的終端所示,您可能安裝了不正確的numpy版本。如果你使用python 3,你會想要做pip3安裝numpy,而不是使用普通(python 2.7)pip。無論哪種方式,你應該嘗試重新安裝numpy,或者如果仍然無法工作,你可以從源代碼構建它。 這是基於這樣一個事實,即問題似乎與numpy軟件包而不是您的系統本身有關。

+0

您好卡里, 我嘗試重新安裝通過點多次,而嘗試與PIP3我得到以下錯誤: PS E:\ Machine Leaning classifier> python pip3 install numpy C:\ Users \ as338011 \ AppData \ Local \ Programs \ Python \ Python36 \ python.exe:無法打開文件'pip3':[Errno 2]沒有這樣的文件或目錄 – Ashutosh

+0

看起來你缺少pip3。你需要先安裝。 –