背景:查看linux中默认的python为python2版本,需要升级到python版本。
0.查看当前python版本
1.下载python3的安装包
wget https://www.python.org/ftp/python/3.7.2/Python-3.7.2.tgz
2. 解压安装包,到指定路径
tar -zxvf Python-3.7.2.tgz -C /opt/module
3.替换linux环境中的python
cd /usr/bin ls python mv python python.bak ln -sv /opt/module/Python-3.7.2/python /usr/bin/python
ll python
4.检查是否升级成功
python
参考:
https://www.cnblogs.com/yaradish/p/10503563.html
https://www.cnblogs.com/z977690557/p/14112071.html
https://www.linuxprobe.com/linux-update-python.html
https://www.zhihu.com/question/265332835?sort=created