yum -y gcc install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel libffi-devel
下载地址 https://www.python.org/ftp/python/3.11.7/Python-3.11.7.tar.xz
上传python文件,解压,进入解压的目录,
配置安装地址
./configure --prefix=/usr/local/python3
make -j4 && make -j4 install
这是因为linux本身安装的是python3.6版本,我没卸载,直接安装的新的
添加环境变量
ln -s /usr/local/python3/bin/python3 /usr/bin/python
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip
bash
python -V
pip -V
ok