How to install OpenCV version 3.1 on Ubuntu 16.04 LTS to work with Python 3.5.1?
I tried this on a VM but obviously that is useful to do if you want to work with Python 2.
16.04opencvpython3
How to install OpenCV version 3.1 on Ubuntu 16.04 LTS to work with Python 3.5.1?
I tried this on a VM but obviously that is useful to do if you want to work with Python 2.
Best Answer
I have OpenCV version 3.1 on Ubuntu 16.04 LTS to work with Python 3.5.1. At the latest version it's fixed, try:
http://cyaninfinite.com/tutorials/installing-opencv-in-ubuntu-for-python-3/
But I didn't download dev python and OpenCV, I took directly from github:
EDIT:
Here are the instructions I tested successfully and mentioned in the link above:
sudo apt-get update
Download the required packages to compile OpenCV:
sudo apt-get install python3.5-dev
python3.5-config --includes
The output should be similar to:-I/usr/include/python3.5m -I/usr/include/x86_64-linux-gnu/python3.5m
. The first part of the output is the expected location & the second part shows the current location of the config file. To solve this problem, we’ll copy the file from the current location to the expected location:sudo cp /usr/include/x86_64-linux-gnu/python3.5m/pyconfig.h /usr/include/python3.5m/
git clone https://github.com/Itseez/opencv.git
. This will download OpenCV 3. Then rename the folderopencv
toopencv-3
Create a
build
directory, move to it and run:make
and thensudo make install
.