码迷,mamicode.com
首页 > 编程语言 > 详细

Centos6.5安装python2.7与pip

时间:2018-06-14 18:42:47      阅读:194      评论:0      收藏:0      [点我收藏+]

标签: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)

 

Centos6.5安装python2.7与pip

标签:root   configure   gcc   pytho   config   utc   uname   gnu   2.7   

原文地址:https://www.cnblogs.com/LuckWJL/p/9183405.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!