tonglin0325的个人主页

Ubuntu16.04离线安装python3.8

1.下载python3.8

1
2
3
cd ~/Download
wget https://www.python.org/ftp/python/3.8.11/Python-3.8.11.tgz

解压

1
2
tar -zxvf Python-3.8.11.tgz

2.创建目录

1
2
3
4
5
cd /usr/local
sudo mkdir python
cd ./python
sudo mkdir python3.8

3.编译安装

1
2
3
4
./configure prefix=/usr/local/python/python3.8 --enable-optimizations
make -j 2
make altinstall >&1|tee make.log

4.配置环境变量

1
2
3
# python
export PATH=$PATH:/usr/local/python/python3.8/bin

参考:Ubuntu16.04安装Python3.8,3.7,3.9(含卸载方法,支持多版本共存)