1.下载python3安装包
wget https://www.python.org/ftp/python/3.7.2/Python-3.7.2.tgz
2.解压python的tgz压缩包文件
tar -xzvf Python-3.7.2.tgz
3.进入解压的文件
cd Python-3.7.2
4.在python文件路径下编译python
prefix=/usr/local/python37 ,指定python安装路径,这个路径不要和现有的python路径相同,否则会覆盖之前的python
./configure --prefix=/usr/local/python37
5.执行安装命令
make && make install
6.建立软连接
ln -s /usr/local/python37/bin/python3.7 /usr/bin/python3 ln -s /usr/local/python37/bin/pip3 /usr/bin/pip3
本文永久更新地址:
https://www.fenxiangbe.com/p/linux安装两个python版本.html