How to uninstall opencv3.1?

15,633

Things that didn't work.

  • sudo apt-get purge libopencv-* python-data python-opencv
  • Uninstall the 2.4.11 and Installing the OpenCV3.1 from source then Uninstalled.

After I reinstall and uninstalled the 3.1 version I still can import cv2 without any problem, from cv2.__file__ I remove the '/usr/local/lib/python2.7/dist-packages/cv2.so' file.

Then I installed the 2.4version from source and apt-get install python-opencv the cv2.__version__ is OK now.

Share:
15,633

Related videos on Youtube

dariush
Author by

dariush

Updated on September 18, 2022

Comments

  • dariush
    dariush almost 2 years

    Long story short, the features in OpenCV3.1 does not work for me. I did uninstall the OpenCV3.1 with sudo apt-get purge libopencv* and install the OpenCV2.4.11 with this, but after installing it, The cv2.__version__'s result is '3.1.0'!!

    Question:

    How to uninstall the OpenCV3.1 and replace it with the 2.4.11 one?


    Editions:

    dpkg -l | grep opencv:

    ii  opencv-data 2.4.8+dfsg1-2ubuntu1 all development data for opencv
    

    whereis opencv

    opencv: /usr/share/opencv

    locate cv.py:

    /home/dariush/ardupilot/modules/mavlink/pymavlink/tools/python_array_test_recv.py
    /usr/lib/python2.7/dist-packages/cv.py
    /usr/lib/python2.7/dist-packages/cv.pyc
    
    • Admin
      Admin over 7 years
      How exactly did you install OpenCV3.1 in the first place?
    • dariush
      dariush over 7 years
      @ParanoidPanda I don't remember!! If I have to guess it would be apt-get.
    • Admin
      Admin over 7 years
      Please check your command history with history.
    • Admin
      Admin over 7 years
      It would just be good to know which package you selected to install. You've probably got dependencies from it still left or something.
    • steeldriver
      steeldriver over 7 years
      What version of Ubuntu are you using? Please edit your question to include the outputs of dpkg -l | grep opencv and whereis opencv and locate cv.py (these will help us figure out how you likely installed it).
    • dariush
      dariush over 7 years
      @steeldriver done.
    • Admin
      Admin over 7 years
      So then purging it with apt-get won't work because that's not how you installed it, you must have purged something else rather than what you compiled from source.
    • dariush
      dariush over 7 years
      @ParanoidPanda agreed, then how can I fix this now?
    • steeldriver
      steeldriver over 7 years
      File /usr/lib/python2.7/dist-packages/cv.py would normally be provided by the opencv python bindings package python-opencv, however that doesn't appear in your dpkg output either so likely was part of your source install. It may be sufficient to install python-opencv from the repository (OTOH it might refuse/complain about overwriting files that are outside of the package management system).