Xubuntu [SOLVED]: Installing cv2 on linux server

Xubuntu [SOLVED]: Installing cv2 on linux server

Home Forums Xubuntu Xubuntu [SOLVED]: Installing cv2 on linux server

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #36861



    I am trying to opencv i.e cv2 on my Linux server which has following configurations.

    Linux D07-CPT-8gb-4cpu-nyc1 4.4.0-92-generic #115-Ubuntu SMP Thu Aug
    10 09:04:33 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

    Before trying on the server I tried this command on my Bash for Windows and working fine here.

    sudo apt-get install libopencv-dev python-opencv

    I ran the same command on Linux server but when I type import cv2 I am getting this error.

    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    ImportError: No module named 'cv2'

    opencvis not listed when I check with pip freeze.
    Note: I am using python 3.5.2



    Accepted AnswerAnswer

    At least on Ubuntu 16.04, there exist Python 2 and Python 3.

    So when install package for python, you should be care of your python version. The default python and pip is for Python 2.


    1. specific the Python version

    sudo python3 -m pip install opencv-python 

    2. install python3-pip, and then use python3 and pip3

    sudo apt install python3-pip
    pip3 install opencv-python

    Source: https://stackoverflow.com/questions/48003424/installing-cv2-on-linux-server
    Author: Silencer
    Creative Commons License
    This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.