Centos7 安装 python2.7

Centos7 安装 python 2.7.15

1、先安装 GCC 包,如果没安装 GCC包 就输入以下命令行安装;

   (*注:以下记得使用 su 权限)

yum install gcc openssl-devel bzip2-devel 

  

2、用 wget 下载 python 2.7 并解压

     如果没有 wget,先用下面命令安装 wget;

yum -y install wget  

     进入目录 /usr/src  再用 wget 下载 python 2.7

cd /usr/src
wget https://www.python.org/ftp/python/2.7.15/Python-2.7.15.tgz

  再解压 python2.7

tar xzf Python-2.7.15.tgz

  

3. 安装 python 2.7

   进入上面解压的 Python-2.7.15 解压文件中使用下面命令行安装

扫描二维码关注公众号,回复: 5484933 查看本文章
cd Python-2.7.15
./configure --enable-optimizations
make altinstall

 

4. 查看安装版本

python -V

  可以看到输出 Python 2.7.15 就安装完成。

5、安装 PIP

curl "https://bootstrap.pypa.io/get-pip.py" -o "get-pip.py"
python2.7 get-pip.py

---------------------------------------------------------------------------------------------------------

原作者:Rahul Kumar

本文转译自  https://tecadmin.net/install-python-2-7-on-centos-rhel/

赞赏码

猜你喜欢

转载自www.cnblogs.com/Jomini/p/10507077.html