[分享栈]centos7安装python3.8.5

[分享栈]centos7安装python3.8.5

武小栈
2020-08-03 / 1 评论 / 4,814 阅读 / 正在检测是否收录...

1、切换到root账户

2、更新yum源

yum update

中间有询问过程,直接y同意更新就好了。

python385yumupdate.png

3、安装依赖项

yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel libffi-devel gcc make

python385yilaistart.png

4、下载python3.8.5

wget -P /home https://cdn.npm.taobao.org/dist/python/3.8.5/Python-3.8.5.tgz

python385download385.png

5、解压

cd /home && tar -zxvf Python-3.8.5.tgz

python385yilaistart.png

6、配置编译

cd Python-3.8.5
mkdir /usr/local/python3.8.5
./configure --prefix=/usr/local/python3.8.5 
./configure --enable-optimizations  

如果出现错误信息:SystemError: <built-in function compile> returned NULL without setting an error generate-posix-vars failed;则需要升级gcc版本,请先升级gcc版本,参考链接centos7安装gcc10.2.0

python385peizhi1.png

python385peizhi2.png

python385peizhi3.png

7、编译安装

make && make install

python385install.png

8、建立链接

ln -s /usr/local/python3.8.5/bin/python3 /usr/bin/python3  
ln -s /usr/local/python3.8.5/bin/pip3 /usr/bin/pip3

如果提示链接已存在,删除原链接即可。

python385link.png

9、查询版本

python3 --version

python385version.png

0

评论 (1)

取消
  1. 头像
    阿翔
    Windows 10 · Google Chrome

    不错

    回复