Linux+OpenCV3+Python3.5: Difference between revisions

From ICO wiki
Jump to navigationJump to search
Lvosandi (talk | contribs)
No edit summary
Lvosandi (talk | contribs)
No edit summary
Line 19: Line 19:
Install numpy:
Install numpy:


  pip3 install numpy
  CFLAGS="-O3 -march=core-avx-i" pip3 install --no-use-wheel numpy


Install OpenCV:
Install OpenCV:
Line 28: Line 28:
  mkdir build
  mkdir build
  cd build
  cd build
  CFLAGS="-pipe -march=native" CXXFLAGS="-pipe -march=native" cmake -D INSTALL_PYTHON_EXAMPLES=ON -D WITH_XIMEA=BOOL:ON ..
  CFLAGS="-pipe -O3 -march=core-avx-i" CFLAGS="-pipe -O3 -march=core-avx-i" cmake -D INSTALL_PYTHON_EXAMPLES=ON -D WITH_XIMEA=BOOL:ON ..


Observe the output of the last command and make sure CMake detected Python 3.5.
Observe the output of the last command and make sure CMake detected Python 3.5.

Revision as of 09:37, 28 April 2016

Python 3.5 brings support for async programming in Python making it possible to use async web programming.


These instructions should work on Ubuntu 16.04 and Debian Stretch, in older versions the OpenCV build will pick up Python 3.4 and this is going to result in mess.

Install Python:

apt-get install cmake wget python3.5-dev build-essential unzip \
    libjpeg-dev libtiff5-dev libjasper-dev libpng12-dev \
    libavcodec-dev libavformat-dev libswscale-dev libv4l-dev \
    libgtk-3-dev

Install pip:

wget https://bootstrap.pypa.io/get-pip.py
python3 get-pip.py

Install numpy:

CFLAGS="-O3 -march=core-avx-i" pip3 install --no-use-wheel numpy

Install OpenCV:

wget https://github.com/Itseez/opencv/archive/3.1.0.zip
unzip 3.1.0.zip
cd opencv-3.1.0
mkdir build
cd build
CFLAGS="-pipe -O3 -march=core-avx-i" CFLAGS="-pipe -O3 -march=core-avx-i" cmake -D INSTALL_PYTHON_EXAMPLES=ON -D WITH_XIMEA=BOOL:ON ..

Observe the output of the last command and make sure CMake detected Python 3.5. Finally build OpenCV and install it

make -j32
sudo make install