RedHat:安装Python3.7
学习自:rhel安装python3.7_redhat 安装python3_weixin_44282127的博客-CSDN博客
1、准备工作
以下过程需要以用户角度开展:
su - 用户
1)创建存放安装包的文件夹
mkdir /opt/python
2)去Python官网下载所需的python版本(这里以3.7.16为例)
①选择Linux
②找到对应版本的python
③复制链接地址
3)进入/opt/python目录下
cd /opt/python
4)使用刚才复制的地址,下载,解压缩
wget https://www.python.org/ftp/python/3.7.16/Python-3.7.16.tgz tar -xvzf Python-3.7.16.tgz
5)安装缺少的包
yum -y install zlib* 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
6)进入Python目录下
cd /opt/python/Python-3.7.16/
7)编译
./configure --prefix=/usr/local/python3
8)安装
sudo make sudo make install
9)生成软连接,将python3变为指令
ln -s /usr/local/python3/bin/python3 /usr/bin/python3
10)修改环境变量,将pip3变为指令
PATH=$PATH:/usr/local/python3/bin:
11)测试