centos 7 python版本更新
原版本2.7.5 更新版本2.7.13
注:由于linux自带的python,系统对其有一定的依赖,因此建议保留原来的版本;常常出现的是yum功能问题;另 centos 7版本可以使用yum安装的方式进行pip安装,比手动安装更快捷方便
1.安装依赖包
yum -y install gcc
yum install -y zlib-devel bzip2-devel openssl-devel ncurses-devel
2.包下载:
wget https://www.python.org/ftp/python/2.7.13/Python-2.7.13.tgz
3.解压:
tar -zxvf Python-2.7.13.tgz
4.创建安装目录:
mkdir /usr/local/python2.7.13
5.切换目录:
cd Python-2.7.13
6.编译
./configure --prefix=/usr/local/python2.7.13
结果:
done
checking for ensurepip... no
configure: creating ./config.status
config.status: creating Makefile.pre
config.status: creating Modules/Setup.config
config.status: creating Misc/python.pc
config.status: creating Modules/ld_so_aix
config.status: creating pyconfig.h
creating Modules/Setup
creating Modules/Setup.local
creating Makefile
If you want a release build with all optimizations active (LTO, PGO, etc),
please run ./configure --enable-optimizations
please run ./configure –enable-optimizations (这一句可不执行)
7.安装:
make && make install
结果:
rm -f /usr/local/python2.7.13/share/man/man1/python.1
(cd /usr/local/python2.7.13/share/man/man1; ln -s python2.1 python.1)
if test "xno" != "xno" ; then \
case no in \
upgrade) ensurepip="--upgrade" ;; \
install|*) ensurepip="" ;; \