How to install openCV 2.4.13 for Python 2.7 on Ubuntu 16.04?

后端 未结 4 1695
心在旅途
心在旅途 2021-02-04 14:20

I have tried a lot of online posts to install opencv but they are not working for Ubuntu 16.04. May anyone please give me the steps to install openCV 2.4.13 on it?

4条回答
  •  长发绾君心
    2021-02-04 15:03

    If you have more than one opencv installation on your machine, now I tell you the most direct, effective and easy way to choose opencv version in python.

    You can type the following command to check the current opencv version in python

    import cv2
    cv2.__version__
    

    default opencv version

    opencv path in python is set in system variable PYTHONPATH, you can echo this variable with echo $PYTHONPATH
    current PYTHONPATH

    If I want to use opencv3.x in python, then using vi or gedit open .bashrc in the home folder, add this content to the end

    export PYTHONPATH=/home/ismart/ipa2/devel/lib/python2.7/dist-packages:/home/ismart/catkin_ws/install_isolated/lib/python2.7/dist-packages:/usr/local/opencv3.x/lib/python2.7/dist-packages
    

    Replace the path with yours

提交回复
热议问题