ImportError: No module named 'cv2' Python3

前端 未结 6 1772
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-31 05:30

I have such a problem

(face_det) user@pc:~$ python3
Python 3.5.3 (default, Apr 22 2017, 00:00:00) 
[GCC 4.8.4] on linux
Type \"help\", \"copyright\", \"credi         


        
6条回答
  •  囚心锁ツ
    2020-12-31 05:44

    My problem was trying to use opencv version 4.2.x on macOS Catalina. Turns out they are not compatible. What i initially used was:

    pip3 install opencv-python
    

    Which gives you the newest version. So i installed a previous version with this and solved my problem:

    pip3 install opencv-python==4.1.1.26
    

    If you type:

    pip3 install opencv-python==10.99.100
    

    For example, that version does not exist so it will give you a list of all available versions so you can choose.

    Tried on:

    • Catalina 10.15.4
    • Python 3.5.9

    Edit: I also had to downgrade from python 3.7 to 3.5.9 in order for it to work.

提交回复
热议问题