一、 环境
操作系统:CentOS 7.9 64位
Python版本:3.8.2
二、 安装包:
百度网盘地址及提取码:
地址:https://pan.baidu.com/s/1P1kSAm_OuAiBZEShJi1XPA 提取码:88ra
三、 步骤:
3.1上传安装包并解压缩
mkdir -p /usr/local/python3
cd /usr/local/python3
tar -zxvf Python-3.8.2.tgz
3.2安装gcc和依赖
yum install gcc
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 libffi-devel
3.3 3.7 版本之后需要 libffi-devel、zlib
yum install libffi-devel -y
yum install zlib* ---中途需要输入“Y”
3.4 生成编译脚本(指定安装目录)
cd Python-3.8.2
./configure --with-ssl --prefix=/usr/local/python3
3.5 编译&编译安装
make
make install
3.6 检查python3的编译器
/usr/local/python3/bin/python3
3.7 建立Python3和pip3的软链接:
ln -s /usr/local/python3/bin/python3 /usr/bin/python3
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
四、 验证
which python3
结果为:/usr/bin/python3
标签:bin,python,local,devel,usr,install,linux,安装,python3 From: https://www.cnblogs.com/chenhongyi/p/17904901.html