2017-07-27 32 views
0

我安裝的OpenCV的python 3.6.0 使用命令爲什麼在Python 3.6.0進口CV2顯示錯誤的Anaconda3

pip install OpenCV-python 

但顯示錯誤,當我在代碼
代碼

使用
import cv2 
    def vidPlay(): 
     cap = cv2.VideoCapture(0) 
     ret, inputImage = cap.read() 
     if ret==True: 
      return inputImage 
     cap.release() 
    a = vidPlay() 
    print(a) 
    print("done ") 
    cv2.imshow(a) 

錯誤

 File "<stdin>", line 1, in <module> 
    File "C:\Users\yyy\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 866, in runfile 
    execfile(filename, namespace) 
    File "C:\Users\yyy\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 102, in execfile 
    exec(compile(f.read(), filename, 'exec'), namespace) 
    File "C:/Users/yyy/Desktop/cameraPlay.py", line 1, in <module> 
    import cv2 
    File "C:\Users\yyy\Anaconda3\lib\site-packages\cv2\__init__.py", line 7, in <module> 
    from . import cv2 
ImportError: DLL load failed: The specified module could not be found. 

我在問題上嘗試過不同的解決方案,但沒有解決我的問題。

+1

請出示你的代碼,當我運行的代碼引發錯誤 –

+0

@MuhammadAsif行這顯示出[進口CV2當DLL加載失敗錯誤] –

+1

可能的複製(https://stackoverflow.com/questions/43184887/dll-load-failed-error-when-importing-cv2) –

回答

0

這個問題似乎是以下問題的重複:

DLL Load Failed Error when importing CV2

我複製從這個問題接受的答案,爲了便於:

您可以下載在Windows 32位或64位計算機上使用最新的OpenCV 3.2.0 for Python 3.6,請從該非官方站點查找以opncv_python-3.2.0-cp36-cp36m開頭的文件。然後鍵入命令下面進行安裝:

PIP安裝opencv_python-3.2.0-CP36-cp36m-win32.whl(32位版本) PIP安裝opencv_python-3.2.0-CP36-cp36m-win_amd64.whl( 64位 版本)我認爲它會更容易。

撰稿:@thewaywewere

+0

我使用這個命令pip install opencv-python –