下载:
https://www.python.org/ftp/python/3.7.4/
.tgz文件,解压后,进入该文件夹
编译
./configure
make
sudo make install
当 sudo make install 时:报错ModuleNotFoundError: No module named ‘_ctypes’
补全配置
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
sudo apt-get install build-essential python-dev python-setuptools python-pip python-smbus
sudo apt-get install build-essential libncursesw5-dev libgdbm-dev libc6-dev
sudo apt-get install zlib1g-dev libsqlite3-dev tk-dev
sudo apt-get install libssl-dev openssl
sudo apt-get install libffi-dev
删除原来的软连接
rm -rf /usr/bin/python3
rm -rf /usr/bin/pip3
添加python3的软链接
ln -s /usr/local/bin/python3.7 /usr/bin/python3
添加 pip3 的软链接
ln -s /usr/local/bin/pip3.7 /usr/bin/pip3
验证:python3 --version