1、下载python3.7.0
https://www.python.org/downloads/release/python-370/
2、创建Linux的python37目录
mkdir /usr/local/python37
3、解压python3.7.0源码
tar zxvf python3.7.0.tar.zg
4、配置编译参数
./configure --prefix=/usr/local/python37
5、make
6、make install
注意:make install 时可能会出现如下错误:
问题1:zipimport.ZipImportError: can't decompress data; zlib not available
处理方式:安装zlib的类库
apt-get install zlib*
问题2:ModuleNotFoundError: No module named '_ctypes'
apt-get update
apt-get upgrade
apt-get dist-upgrade
apt-get install build-essential python-dev python-setuptools python-pip python-smbus
apt-get install build-essential libncursesw5-dev libgdbm-dev libc6-dev
apt-get install zlib1g-dev libsqlite3-dev tk-dev
apt-get install libssl-dev openssl
apt-get install libffi-dev