Centos安装 Python

参考文档

  1. https://www.cnblogs.com/emanlee/p/6111613.html

更新流程

注意:需要root权限

查看python版本:
python –version

  1. 下载Python-2.7.12
wget https://www.python.org/ftp/python/2.7.12/Python-2.7.12.tgz

  1. 解压
tar   zxvf   Python-2.7.12.tgz

  1. 更改工作目录
cd Python-2.7.12  

  1. 安装
./configure  
make all             
make install  
make clean  
make distclean  

  1. 查看版本信息
    /usr/local/bin/python2.7 -V

  2. 建立软连接,使系统默认的 python指向 python2.7

#mv /usr/bin/python /usr/bin/python2.6.6  
#ln -s /usr/local/bin/python2.7 /usr/bin/python  

安装zlib

yum install zlib
yum install zlib-devel
yum install openssl
yum install openssl-devel

重新编译安装

cd /root/Python-2.7.12
./configure
make install

安装setuptools

cd /root
wget --no-check-certificate https://pypi.python.org/packages/source/s/setuptools/setuptools-12.0.3.tar.gz#md5=f07e4b0f4c1c9368fcd980d888b29a65 

tar -zxvf setuptools-12.0.3.tar.gz
cd setuptools-12.0.3
python setup.py install

安装pip

wget "https://pypi.python.org/packages/source/p/pip/pip-1.5.4.tar.gz#md5=834b2904f92d46aaa333267fb1c922bb" --no-check-certificate

tar -axf pip-1.5.4.tar.gz 
cd pip-1.5.4/
python setup.py install

你可能感兴趣的:(Centos安装 Python)