yum -y groupinstall "Development tools" yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel yum install libffi-devel -y
wget https://www.python.org/ftp/python/3.8.2/Python-3.8.2.tgz tar -zxvf Python-3.8.1.tgz
cd Python-3.8.1.tgz ./configure --prefix=/usr/local/python3
make && make install
页面提示:Successfully installed pip-21.2.4 setuptools-58.1.0 安装成功
vim /etc/profile
点击键盘“o”键在文档最后新增如下代码
#python3.8 configuration PATH=$PATH:/usr/local/python3/bin: export PATH
保存并退出vim
点击键盘ESC,输入:wq回车
使配置生效
source /etc/profile
python3 -V
python -V
自带python已生效
注:如果不想用自带的2.7.5 可以进行升级。只需在/etc/profile文件中 新增python2*的路径即可
PATH=$PATH:/usr/local/python3/bin:/usr/local/python2.7.15/bin