centos7 安装 python3

sudo yum -y update
sudo yum -y install openssl-devel libffi-devel bzip2-devel
sudo yum -y groupinstall "Development Tools"

#安装 Python 3.10 必需的 openssl >= 1.1.1
wget https://www.openssl.org/source/openssl-1.1.1q.tar.gz --no-check-certificate
tar zxf openssl-1.1.1q.tar.gz
cd openssl-1.1.1q
./config --prefix=/usr/local/openssl-1.1.1
sudo make && sudo make install
#安装 Python 3.10
wget https://www.python.org/ftp/python/3.10.5/Python-3.10.5.tgz
tar zxf Python-3.10.5.tgz
cd Python-3.10.5
./configure --enable-optimizations --with-openssl=/usr/local/openssl-1.1.1 --with-openssl-rpath=auto
sudo make altinstall

 

建立软链接

#查看下位置在哪,添加软链接
whereis python
cd /usr/bin/
ll python*
ln -s /usr/local/bin/python3.10 /usr/bin/python3
#python3 自带pip3, 看在哪
whereis pip3
ln -s /usr/local/bin/pip3 /usr/bin/pip3

posted on 2019-10-01 21:57  震撼起飞  阅读(173)  评论(0编辑  收藏  举报

导航