-
安装依赖
sudo yum -y groupinstall "Development tools" sudo 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
-
下载python3源码
wget https://www.python.org/ftp/python/3.7.6/Python-3.7.6.tgz
-
解压
tar -zvxf Python-3.7.6.tgz
-
进入到解压目录
cd Python-3.7.6
-
创建python3安装目录
sudo mkdir /usr/local/python3
-
配置python3的安装目录
./configure --prefix=/usr/local/python3
-
编译安装
sudo make sudo make install
注意: 如果没有gcc编译器需要安装
-
创建软链接
# python3编译器软链接 sudo ln -s /usr/local/python3/bin/python3 /usr/bin/python3 # pip3包管理器软链接 sudo ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
-
输入python3, 完成
Centos7下源码安装Python3.7
最新推荐文章于 2024-04-02 13:13:01 发布