centos7 安装python3.7.11 笔记

 

安装python依赖包
yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make

编译和安装
mkdir /usr/local/python3
./configure prefix=/usr/local/python3 --enable-optimizations
make && make install

删除旧的软链接,创建新的软链接到最新的python
rm -rf /usr/bin/python
ln -s /usr/local/python3/bin/python3 /usr/bin/python
python -V

创建pip3的软链接
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3

修复yum的错误
vi /usr/bin/yum
修改首行:#!/usr/bin/python2.7

vi /usr/libexec/urlgrabber-ext-down
修改首行:#!/usr/bin/python2.7

 

posted @ 2019-03-03 23:12  邱亮  阅读(551)  评论(0编辑  收藏  举报