簡體   English   中英

導入 CV2:DLL 加載失敗:pip 安裝成功時找不到指定的模塊

[英]Import CV2: DLL load failed: The specified module could not be found while successful pip installation

我在 Pycharm IDE (Windows10) 中使用 Python 3.7 和 OpenCV 4.2。 我的一位同事無意中更改了系統環境變量(我們不知道究竟發生了什么)。 然后我發現我的代碼沒有出現這個錯誤!:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: DLL load failed: The specified module could not be found.

然后我使用了這個命令:

pip uninstall opencv-python
pip uninstall opencv-contrib-python
pip install opencv-python

所有這些都成功執行,但是當我編寫import cv2出現上述錯誤。 順便說一句,系統知道命令Python ,它顯示了python.exe的正確路徑。 此外,像import numpy這樣的命令可以正常工作! 我該如何解決這個問題?

我找到了答案! site-packages/cv2路徑中有一個額外的cv2.py文件。 所以,我刪除了它並且代碼有效

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM