Installing OpenCV for Python on Ubuntu, getting ImportError: No module named cv2.cv

后端 未结 20 851
遥遥无期
遥遥无期 2020-11-28 23:48

I have an Ubuntu 14.04 system, on which I want to install OpenCV and use it with Python 2.x.

I installed OpenCV using the instructions here: https://help.ubuntu.com/

相关标签:
20条回答
  • 2020-11-29 00:36

    Its complete installation nightmare, but I'll give one more hope you can avoid building opencv from source:

    pip install opencv-contrib-python

    0 讨论(0)
  • 2020-11-29 00:37

    For those who are trying to use 3.1.0 but after installing python says "cv2 module not found".

    You likely have python but not python-dev.

    sudo apt-get install python-dev
    

    then reinstall 3.1.0 and it'll work.

    0 讨论(0)
  • 2020-11-29 00:38

    if you are using pycharm platform it's very simple go into view=>tool windows==>python console after that you will see in the bottom the console with [1] : type this !pip install opencv-python

    0 讨论(0)
  • 2020-11-29 00:41

    I also had this issue. Tried different things. But finally

    conda install opencv
    

    worked for me.

    0 讨论(0)
  • 2020-11-29 00:42

    I think you don't have the python-opencv package.

    I had the exact same problem and

    sudo apt-get install python-opencv
    

    solved the issue for me.

    you can install opencv from the following link https://www.learnopencv.com/install-opencv3-on-ubuntu/ It works for me . apt-get install doesnt contain many packages of opencv

    0 讨论(0)
  • 2020-11-29 00:42

    Find where the cv2.so is, for example /usr/local/lib/python2.7/dist-packages, then add this into your ~/.bashrc by doing:

    sudo gedit ~/.bashrc
    

    and add

    export PYTHONPATH=/usr/local/lib/python2.7/dist-packages:$PYTHONPATH
    

    In the last line

    And then remember to open another terminal, this can be work, and I have solve my problem. Hope it can help you.

    0 讨论(0)
提交回复
热议问题