-
下载python
wget https://www.python.org/ftp/python/3.6.6/Python-3.6.6.tgz -
解压安装包
tar xf Python-3.6.6.tgz -
安装/升级 gcc
sudo yum install make gcc gcc-c++ -
修改配置文件
vim /opt/Python-3.6.6/Modules/Setup.dist下面5行取消注释
_socket socketmodule.c timemodule.c
SSL=/usr/local/ssl
_ssl _ssl.c
-DUSE_SSL -I ( S S L ) / i n c l u d e − I (SSL)/include -I (SSL)/include−I(SSL)/include/openssl
-L$(SSL)/lib -lssl -lcrypto -
安装配置
./configure --prefix=/opt/python3 -
安装
yum install openssl-devel -
编译
make -
安装
make install -
删除原有的链接
rm -rf /usr/bin/python3 -
创建新链接
ln -s /opt/python3/bin/python3 /usr/bin/python3
ln -s /opt/python3/bin/pip3 /usr/bin/pip3 -
查看版本
python3 -V
Linux下安装python3
最新推荐文章于 2022-08-11 23:10:29 发布