卸载 python 3.5
sudo apt remove python3
再执行如下命令自动清理 python3.5 的依赖sudo apt autoremove
sudo apt autoremove
更新树莓派系统
sudo apt-get update
sudo apt-get upgrade
安装python需要的依赖
sudo apt-get install build-essential libsqlite3-dev sqlite3 bzip2 libbz2-dev
下载Python源码、解压 (可能有新版) 新版下载链接
wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz
tar zxvf Python-3.7.0.tgz && cd Python-3.7.0
配置、编译、安装
sudo mkdir /usr/local/python3
sudo ./configure --prefix=/usr/local/python3
sudo make
sudo make install
创建符号链接
sudo ln -s /usr/local/python3/bin/python3 /usr/bin/python3
sudo ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
测试安装成功