CentOS 7 升级Python3版本到3.12.9
-
一个很老的项目更新到最新的项目版本,需要升级Python!又折腾一次!
阿里云Yum库
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo yum clean all yum makecache
如果报错,禁用docker-ce
yum-config-manager --disable docker-ce-stable
升级Python3.12.9
yum -y install gcc zlib zlib-devel libffi libffi-devel yum install readline-devel yum install openssl-devel openssl11 openssl11-devel export CFLAGS=$(pkg-config --cflags openssl11) export LDFLAGS=$(pkg-config --libs openssl11) wget https://www.python.org/ftp/python/3.12.9/Python-3.12.9.tgz tar zxvf Python-3.12.9.tgz cd Python-3.12.9 ./configure --prefix=/usr/python --with-ssl make && make altinstall python3 -V rm /usr/bin/pip3 rm /usr/bin/python3 ln -s /usr/python/bin/pip3.12 /usr/bin/pip3 ln -s /usr/python/bin/python3.12 /usr/bin/python3