![](/img/trans.png)
[英]How can I solve "import cv2, ImportError: DLL load failed " in Python 3.7 and OpenCV 4.1.1 on VsCode?
[英]How to solve ImportError on import cv2 without uninstalling
我已經從源代碼安裝了OpenCV3,並在運行import cv2
之后收到錯誤消息:
ImportError: dlopen(/Users/Victor/.virtualenvs/cv/lib/python3.5/cv2.so, 2): Symbol not found: _PyCObject_Type
Referenced from: /Users/Victor/.virtualenvs/cv/lib/python3.5/cv2.so
Expected in: flat namespace
in /Users/Victor/.virtualenvs/cv/lib/python3.5/cv2.so
我真的很想這樣做,而無需重新安裝OpenCV,因為我不想再經歷一次。 如果有幫助的話,我在我的路上是PYTHONPATH="/usr/local/Cellar/python3/3.5.1/"
我解決此問題的方法是從opencv / build / lib目錄中獲取cv2.cpython-35m-darwin.so文件,並將其放在我的virtualenv文件夾中的cv2.so處
嘗試這個
export PYTHONPATH=/usr/local/Cellar/python3/3.5.1:$PYTHONPATH
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.