centOS安装python3.8教程

外链CSDN


安装编译相关工具:

1.yum -y groupinstall "Development tools"

2.yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel

3.yum install libffi-devel -y

下载python安装包:

#下载页面上的安装包

wget https://www.python.org/ftp/python/3.8.3/Python-3.8.3.tgz

#解压压缩包

tar -zxvf  Python-3.8.3.tgz

编译python:

 #创建编译安装目录

mkdir /usr/local/python3

cd Python-3.8.3

# 配置安装位置

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

make && make install

添加python3的软连接:

# 查看当前python软连接

ll /usr/bin/ |grep python

#删除原先的python2.7软连接和pip软连接

rm -rf /usr/bin/python

rm -rf /usr/bin/pip

#添加 python3 和 pip3 的软链接

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

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

你可能感兴趣的:(centOS安装python3.8教程)