欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

centos7升级python3.7

程序员文章站 2022-03-11 22:31:06
...
wget https://www.python.org/ftp/python/3.7.1/Python-3.7.1.tar.xz
## 安装报错找不到 _ctype zlib 等模块
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 -y install gcc kernel-devel kenel-headers make bzip2
yum -y install readline-devel libffi-devel
yum -y install e2fsprogs-devel uuid-devel libuuid-devel
# 解压文件
tar -xvf Python-3.7.1.tar.xz
# 进入到该文件夹
cd Python-3.7.1/
# --prefix 欲安装目录
./configure --prefix=/usr/local/python3.7 --enable-optimizations
# 编译安装,make时间比较长,大概需要15分钟
make
make install
rm -f /usr/bin/python
ln -s /usr/local/python3.7/bin/python3.7 /usr/bin/python
ln -s /usr/local/python3.7/bin/pip3 /usr/bin/pip3

# 还需要重新编译安装才有效

如果先make再yum,可能还找不到,需要再次configure

相关标签: python3 centos