在raspbian OS上安装python 3.5.3上的opencv

时间:2018-05-16 15:51:31

标签: python python-3.x opencv raspberry-pi3 raspbian

在安装opencvface_recognition时,事实证明face_recognition库在python 2.7.13上是不可能的,但它在python python 3.5上正常工作,其中{{1在python 2.7上工作正常,但它不是在python 3.5上安装。

我想在Python上编译两者! 有什么建议吗?

1 个答案:

答案 0 :(得分:0)

遵循以下命令:(对我有用)

-> sudo apt update

-> sudo apt upgrade

-> sudo apt-get install python3-pip

pi@raspberrypi:~ $ python3 -V
Python 3.5.3
pi@raspberrypi:~ $ python2 -V
Python 2.7.13

-> pip3 install numpy

-> pip3 install pillow

-> sudo apt-get install cmake

-> sudo apt-get install python-opencv

-> sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev

-> sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev

-> sudo apt-get install libatlas-base-dev

-> sudo apt-get install libjpeg-dev libtiff5-dev libjasper-dev libpng12-dev -y

-> sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev -y

-> sudo apt-get install libgtk2.0-dev libgtk-3-dev -y

-> sudo pip3 install opencv-python

-> sudo apt-get install libavformat-dev libswscale-dev openexr libopenexr-dev

-> sudo apt-get install libqt4-dev

-> sudo apt-get install libgstreamer0.10-0-dbg libgstreamer0.10-0 libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev



pi@raspberrypi:~ $ python3
Python 3.5.3 (default, Sep 27 2018, 17:25:39) 
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> 

取决于系统。 PI所需时间:2到3个小时。 (总时间)

谢谢:)