更新树莓派系统
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.6.1/Python-3.6.1.tgz
tar zxvf Python-3.6.1.tgz
配置、编译、安装
sudo mkdir /usr/local/python3
sudo ./configure --prefix=/usr/local/python3
sudo make
sudo make install
创建符号链接
sudo rm /usr/bin/python3
sudo rm /usr/bin/pip3
sudo ln -s /usr/local/python3/bin/python3 /usr/bin/python3
sudo ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
测试安装成功
python3