centos 7安装python3

tech2023-08-20  93

1.安装依赖包

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

2.安装wget

yum install wget

3.下载源码包

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

5.解压安装

# 解压压缩包 tar -zxvf Python-3.8.1.tgz # 进入文件夹 cd Python-3.8.1 # 配置安装位置 ./configure prefix=/usr/local/python3 # 安装 make && make install

4.添加软连接

#添加python3的软链接 ln -s /usr/local/python3/bin/python3.8 /usr/bin/python3 #添加 pip3 的软链接 ln -s /usr/local/python3/bin/pip3.8 /usr/bin/pip3

5.测试

[root@swarm Python-3.8.1]# python3 Python 3.8.1 (default, Sep 3 2020, 15:58:14) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> exit()
最新回复(0)