标签:root configure gcc pytho config utc uname gnu 2.7
安装Python2.7
安装环境
[root@localhost1 ~]# cat /etc/redhat-release CentOS release 6.5 (Final) [root@localhost1 ~]# uname -a Linux localhost1 2.6.32-431.el6.x86_64 #1 SMP Fri Nov 22 03:15:09 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
安装依赖包
[root@localhost1 ~]# yum -y install gcc openssl-devel bzip2-devel
下载python源码包
[root@localhost1 ~]# cd /usr/src/ [root@localhost1 src]# wget https://www.python.org/ftp/python/2.7.15/Python-2.7.15.tgz
解压
[root@localhost1 src]# tar xf Python-2.7.15.tgz [root@localhost1 src]# cd Python-2.7.15 [root@localhost1 Python-2.7.15]#
编译安装
[root@localhost1 Python-2.7.15]# ./configure --enable-optimizations [root@localhost1 Python-2.7.15]# make [root@localhost1 Python-2.7.15]# make altinstall
查看安装
[root@localhost1 Python-2.7.15]# /usr/local/bin/python2.7 -V Python 2.7.15
设置软连接
[root@localhost1 Python-2.7.15]# mv /usr/bin/python{,-old} [root@localhost1 Python-2.7.15]# ln -s /usr/local/bin/python2.7 /usr/bin/python
配置yum
[root@localhost1 Python-2.7.15]# sed -i ‘s/python/python-old/‘ /usr/bin/yum
安装pip
[root@localhost1 Python-2.7.15]# python -m ensurepip Collecting setuptools Collecting pip Installing collected packages: setuptools, pip Successfully installed pip-9.0.3 setuptools-39.0.1 [root@localhost1 Python-2.7.15]# pip -V pip 9.0.3 from /usr/local/lib/python2.7/site-packages (python 2.7)
标签:root configure gcc pytho config utc uname gnu 2.7
原文地址:https://www.cnblogs.com/LuckWJL/p/9183405.html