ImportError: No module named 'cv2' Python3

前端 未结 6 1799
爱一瞬间的悲伤
爱一瞬间的悲伤 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:52

    I had a similar problem and the same error. In my case, I was using PyCharm. The problem was that the project's interpreter was pointing to a different installation of Python.

    In my system, I had four versions of python (eg. python3 installed in a python36 folder, another python in an anaconda3 folder and others). In my PyCharm project, when I examined my settings (under File->Settings->Project:xxxx ->Project interpreter), I found that they were pointing to the interpreter in the anaconda3 folder.

    However, my default pip installed the opencv-python module under the python36 folder. Therefore, I just had to change the project interpreter to point to the python installed in python36 folder and it worked.

    If you would like to keep using Anaconda3 then you have to browse to the anaconda3 folder and run pip install opencv-pithon in that folder.

提交回复
热议问题