安装python3.8
1. # wget https://www.python.org/ftp/python/3.8.1/Python-3.8.1.tgz !获取Python软件包
2. # tar -zxvf Python-3.8.1.tgz !解压
3. # cd Python-3.8.1
4. # yum -y install libffi-devel zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make !安装相关依赖
5. # ./configure !检查当前环境是否满足要安装软件的依赖关系
6. # make && make install !编译
注:zlib和zlib-devel的区别为zlib-devel为开发版,而zlib为运行版。
若wget没有安装,则:
# yum -y install wget
环境变量修改
1. # vi ~/.bashrc
2. PATH=$PATH:$HOME/bin:/usr/local/python3.8.1/bin
3. source ~/.bashrc
4. # python3 !检查版本
更新python默认指向
1. # ls -l /usr/bin | grep python !查看python命令指向
2. # sudo mv /usr/bin/python /usr/bin/python.bak !备份
# sudo ln -s /usr/local/bin/python3 /usr/bin/python !更新
3. # python !检查版本
更改yum文件,否则安装其他包时会出错。
# vim /usr/bin/yum
# vim /usr/libexec/urlgrabber-ext-down
将两个文件的首行#!/usr/bin/python改为#!/usr/bin/python2