首页  :: 新随笔  :: 管理

centos 安装python3.7

Posted on 2019-07-21 15:57  季枫  阅读(2062)  评论(0编辑  收藏  举报

 先安装依赖包:

yum -y install bzip2 bzip2-devel ncurses openssl openssl-devel openssl-static xz lzma xz-devel sqlite sqlite-devel gdbm gdbm-devel tk tk-devel libffi-devel

 

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/python3
ln -s /usr/local/python3.7/bin/python3.7 /usr/bin/python3
ln -s /usr/local/python3.7/bin/pip3 /usr/bin/pip3

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

 参考:https://blog.csdn.net/qshimi/article/details/86421206

智读 | 成都会领科技有限公司官网 | 智读App下载 | 每天听本书的博客 | |