OpenCV resolve errors in Python3 import cv2

First replacement source, see https://www.cnblogs.com/cc-xiao5/p/11233256.html , remember to update the library

Followed by the following operations

A mounting Python-dev

sudo apt-get install aptitude 
sudo aptitude install python-dev 

Second, the installation pip3

sudo apt-get install python3-pip
sudo pip3 install --upgrade pip

Third, the installation CV2

First update sudo apt-get update and then install it

sudo pip3 install opencv-python

 

Finally, incidentally installed numpy, scipy, matplotlib remember to change the permissions

pip3 install numpy
pip3 install scipy
pip3 install matplotlib
pip3 install pandas

 If the system has python2 and python3, will be set as the default python3

sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 100
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 150

 

Guess you like

Origin www.cnblogs.com/cc-xiao5/p/11258736.html