ubuntu系统怎么安装python版本的opencv
发布网友
发布时间:2022-04-20 20:01
我来回答
共1个回答
热心网友
时间:2023-08-04 02:01
由于ubuntu14.04/16.04都自带了python2.7和python3.5,所以无需在安装python。
检查python是否安装:
~ whereis python
首先需要的是 pip:
~ sudo apt-get install python3-setuptools python3-dev sudo easy_install3 pip
然后是 numpy:
~ pip3 install numpy
安装依赖:
~ sudo apt-get install build-essential sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
安装opencv3:
~ wget https://codeload.github.com/opencv/opencv/zip/3.2.0
~ unzip 3.2.0 && cd 3.2.0
cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local PYTHON3_EXECUTABLE=/usr/bin/python3 PYTHON_INCLUDE_DIR=/usr/include/python3.4 PYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.4m.so PYTHON3_NUMPY_INCLUDE_DIRS=/usr/local/lib/python3.4/dist-packages/numpy/core/include ..
~ make -j4
~ sudo make install