ubuntu系统怎么安装python版本的opencv

2022-08-08 科技 79阅读
由于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
声明:你问我答网所有作品(图文、音视频)均由用户自行上传分享,仅供网友学习交流。若您的权利被侵害,请联系fangmu6661024@163.com