Centos 7 x86_64 安装 Python3.7.4

wget https://bootstrap.pypa.io/get-pip.py
python get-pip.py
yum -y install gcc
#下载文件
wget https://www.python.org/ftp/python/3.7.4/Python-3.7.4.tgz
#解压
tar zxf Python-3.7.4.tgz
#编译cd Python-3.7.4
./configure
#安装
make && make install
#添加环境变量
PATH=$PATH:$HOME/bin:/usr/local/python3.7.1/bin
#更新python默认指向为python3.7
mv /usr/bin/python /usr/bin/python.bak
ln -s /usr/local/bin/python3 /usr/bin/python
mv /usr/bin/pip /usr/bin/pip.bak
ln -s /usr/local/bin/pip3 /usr/bin/pip

常见问题:

1.3.7版本需要两个新的包libffi-devel和zlib-deve,安装此包之后再次进行编译安装即可。

yum install libffi-devel -yyum -y install zlib zlib-deve

 2.yum失败

[3 home]# yum
  File "/usr/bin/yum", line 30
    except KeyboardInterrupt, e

版本修改为2.7

vi /usr/libexec/urlgrabber-ext-down
vi /usr/bin/yum-config-manager
vi /usr/bin/yum





相关推荐