安装python3.8.5

1 本地下载 并上传到服务器 https://www.python.org/downloads/source/

2  mkdir -p /usr/local/python3

3  yum -y install gcc zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel libffi-devel zlib*

4 tar -zxf Python-3.8.5.tgz

5 cd Python-3.8.5

6 ./configure --prefix=/usr/local/python3

make && make install

ln -s /usr/local/python3/bin/python3 /usr/bin/python

ln -s /usr/local/python3/bin/pip3 /usr/bin/pip

若出现‘/usr/bin/python’: File exists,可先执行

rm -rf /usr/bin/python
rm -rf /usr/bin/pip

升级python3.8.5以后,运行yum命令就会报错,需要修改yum的配置文件:

vim /usr/bin/yum
vim /usr/libexec/urlgrabber-ext-down
都修改为2.7

posted @ 2023-09-23 09:44  山东张铭恩  阅读(137)  评论(0编辑  收藏  举报