centos
1
| yum install -y openssl openssl-devel zlib-devel zlib
|
debian
1
| apt-get install -y zlibc zlib1g-dev openssl libssl-dev gcc g++ libffi-dev libsqlite3-dev
|
下载python3源码并解压,进入到解压的目录
1 2 3 4
| wget https://www.python.org/ftp/python/3.8.1/Python-3.8.1.tgz tar xzf Python-3.8.1.tgz && cd Python-3.8.1
./configure --prefix=/usr/local/python3 --enable-optimizations --enable-loadable-sqlite-extensions
|
接着编译安装
或用两个线程编译可以使用
1
| make -j2 &&make install -j2
|
在/etc/profile配置环境变量
1 2 3
| #Python3 PATH=$PATH:/usr/local/python3/bin export PATH
|
使环境变量生效 source /etc/profile