Linux 安装Python3

cd /opt

下载安装包解压

wget https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tgz
tar -zxvf  Python-3.7.3.tgz
cd Python-3.7.3

安装编译相关工具

yum -y groupinstall "Development tools"
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
yum install libffi-devel -y

编译安装

mkdir /usr/local/python3 #创建编译安装目录
./configure --prefix=/usr/local/python3
make && make install

创建软连接

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

验证是否成功

python3 -V
pip3 -V
上一篇:高并发架构系列:如何从0到1设计一个类Dubbo的RPC框架


下一篇:专有云笔记