树莓派相关

换源

更换软件源

sudo nano /etc/apt/sources.list

用以下代替第一行

deb http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ buster main non-free contrib
deb-src http://mirrors.tuna.tsinghua.edu.cn/raspbian/raspbian/ buster main non-free contrib

更换系统源

sudo nano /etc/apt/sources.list.d/raspi.list

用以下替换第一行

deb http://mirrors.tuna.tsinghua.edu.cn/raspberrypi/ buster main ui

最后更新软件源列表

sudo apt-get update

这里我用的是Debian10 版本,看清楚自己的版本,否则大坑


Pthon2替换为Python3

卸载Python2

sudo apt-get autoremove python2.7
sudo rm /usr/bin/python
sudo rm /usr/bin/pip 

软链接Python Pip

sudo ln -s /usr/bin/python3.7 /usr/bin/python
sudo ln -s /usr/bin/pip3 /usr/bin/pip

测试

pi@raspberrypi:~ $ python
Python 3.7.3 (default, Apr  3 2019, 05:39:12) 
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
pi@raspberrypi:~ $ pip -V
pip 18.1 from /usr/lib/python3/dist-packages/pip (python 3.7)

安装opencv3

sudo apt-get install python3-opencv

测试一下

pi@raspberrypi:~ $ python
Python 3.7.3 (default, Apr  3 2019, 05:39:12) 
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> cv2.__version__
'3.2.0'

安装pyqt5

推荐pyqt5,pyside的版本有点老,二者差别不大

sudo apt-get install python3-pyqt5

测试一下

pi@raspberrypi:~ $ python
Python 3.7.3 (default, Apr  3 2019, 05:39:12) 
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from PyQt5.Qt import PYQT_VERSION_STR
>>> PYQT_VERSION_STR
'5.11.3'

参考

1.Install OpenCV-Python in Ubuntu
2.Raspbian 镜像使用帮助

你可能感兴趣的:(Raspberry,raspberry,pi)