首页 > 代码库 > Centos6.5下安装python2.7.8

Centos6.5下安装python2.7.8

centos6.5下的自带的python版本是python2.6.6,想体验2.7.8版本,可以到官网下载源码安装:

https://www.python.org/downloads/release/python-278/

mkdir -p ~/opt/python

依赖库:

yum install gcc* -y

yum install openssl-devel -y

yum install bzip2 bzip2-devel -y

解压下载的源码,进入解压出的目录中:

./configure --enable-shared --prefix=/home/yh/opt/python/python-278

make && make install

在.bashrc文件加入:

export PYTHON_HOME=/home/yh/opt/python/python-278

export PATH=${PYTHON_HOME}/bin:$PATH

export LD_LIBRARY_PATH=${PYTHON_HOME}/lib:$LB_LIBRARY_PATH

source .bashrc

然后执行python看看是否是2.7.8版本

以上的安装方法应该是用各linux发行版,也可安装python3.0以上的版本,把各python版本都安装

在/home/yh/opt/python/目录下,想用那个就修改.bashrc文件中PYTHON_HOME=/home/yh/opt/python/XXX

 

Centos6.5下安装python2.7.8