1. 设置语言:中文
vi /etc/locale.conf
LANG=zh_CN.UTF8
2.更新pip(不知道有没有用)
pip install --upgrade pip
3.更新源
yum -y install zlib* bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel gcc make
4.下载python
wget https://www.python.org/ftp/python/3.9.2/Python-3.9.2.tgz
5.解压
tar zxvf Python-3.9.2.tgz
6.指定安装位置
Python-3.9.2/configure --prefix=/usr/local/python3.9
7.编译并安装
make && make install
8.配置映射
ln -s /usr/local/python3.9/bin/python3.9 /usr/bin/python3
ln -s /usr/local/python3.9/bin/pip3.6 /usr/bin/pip3
9.修改之前的python映射
ln -snf /usr/bin/python3 /usr/bin/python
10. 修改yum调用Python2
/usr/bin/yum
#!/usr/bin/python2
11. 修改urlgrabber-ext-down调用Python2
vi /usr/libexec/urlgrabber-ext-down
pip3 install itchat
pip3 install PyExecJS
pip3 install bs4
yum install xdg-utils