centos下python版本升级为2.7.6

操作系统:vm centos6.5 64

1.当前的python版本为2.6.6

python -V
Python 2.6.6

2.下载python2.7.6

wget http://www.python.org/ftp/python/2.7.6/Python-2.7.6.tgz

3.解压python

tar -jxvf Python-2.7.6.tar.bz2

发现没有bzip2软件包

yum install bzip2

4.安装

cd Python-2.7.6 &&  ./configure
没有gcc支持:error: no acceptable C compiler found in $PATH

安装gcc

yum install gcc

继续安装python

./configure && make all && make install && make clean && make distclean

5.建立软连接

mv /usr/bin/python /usr/bin/pythonh2.6.6
ln -sv /usr/local/bin/python2.7 /usr/bin/python

6.查看当前python的版本

python -V
Python 2.7.6

7.当你尝试yum的时候

yum list | grep python

There was a problem importing one of the Python modules 
required to run yum. The error leading to this problem was: 

No module named yum 

Please install a package which provides this module, or 
verify that the module is installed correctly. 

It‘s possible that the above module doesn‘t match the 
current version of Python, which is: 
2.7.3 (default, Aug 1 2014, 18:27:15) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] 

If you cannot solve this problem yourself, please go to 
the yum faq at: 
http://yum.baseurl.org/wiki/Faq

当系统centos6.5中的python软链接到python2.7.6后,yum与python2.7.6不兼容,要指定yum的python版本

vi /usr/bin/yum
#将#!/usr/bin/python改为#!/usr/bin/python2.6.6

#或者是
sed -i ‘s/python/python2.6.6/‘ /usr/bin/yum

8.既然都已经升级了python,顺带就安装pip

安装setuptools

wget https://bitbucket.org/pypa/setuptools/get/default.tar.gz#egg=setuptools-dev
tar zxvf default.tar.gz
cd pypa-setuptools-60d0c9f24d88/
python setup.py install

安装pip

wget https://pypi.python.org/packages/source/p/pip/pip-1.5.tar.gz --no-check-certificate
tar zxvf pip-1.5.tar.gz 
cd pip-1.5
python setup.py install

centos下python版本升级为2.7.6

时间: 2024-08-10 23:27:59

centos下python版本升级为2.7.6的相关文章

随笔,CentOS 下 Python Web 环境的安装

1.下载Python 3.5.1源码2.运行,yum -y install zlib zlib-devel openssl-devel3.解压,运行 ./configure --prefix=/usr/local/python-3.5.14.make && make install5.运行python -V,记住系统自带的python版本号6.ln -fs /usr/local/python-3.5.1/bin/python3.5 /usr/bin/python7.ln -fs /usr/

Centos下Python添加RSA模块

首先,安装setuptools # 这个引导程序会联网下载最新版本setuptools来安装,同时也可以更新本地的setuptools wget http://peak.telecommunity.com/dist/ez_setup.py python ez_setup.py #更新setuptools: python ez_setup.py -U setuptools 然后,通过setuptools来添加rsa模块 easy_install rsa

centos python版本升级到3.x

Linux(CentOS)下将Python的版本升级为3.6.2的方法 1.检查确认系统的相关信息 查看内核版本[[email protected] ~]# cat /etc/redhat-release CentOS release 6.5 (Final) [[email protected] ~]# uname -a Linux zstest1 2.6.32-431.el6.x86_64 #1 SMP Fri Nov 22 03:15:09 UTC 2013 x86_64 x86_64 x8

Centos下升级Python

Centos下升级Python 一.查看本机Pyhton版本 本机Centos6.5 预带Pyhton版本为2.6.6 # python --version >>Python 2.6.6 二.下载欲升级最新Python安装包 可以去官网找最新安装包 https://www.python.org/downloads/ 三.编译安装Python wget   tar -zxvf  Python-2.7.10.tgz cd Python-2.7.10 ./configure make &&a

centos下如何正确升级python

在CentOS上搭建测试环境时候,遇到需要升级python版本的情况,于是就记录了整个升级的过程: 在CentOS5中自带的Python版本是2.4,但是目前许多基于Python的应用软件要求的Python版本应要高于2.4.升级python版本的时候千万不能卸载python 2.4,再安装python2.7,这样可能会导致很多程序无法运行,甚至无法连接网络,最后不得不重新装系统.保守的方式是直接安装python2.7的源码包,也就是python两个版本共存.(因为 Centos里面有很多程序是

CentOS下nginx+python+fastcgi+postgres部署总结(django版)

最近因为项目上的需要开始大量使用nginx,因此也想趁机将以前常用的django+apache的架构换成django+nginx.常见的 django webapp 部署方式采用FCGI 或 WSGI的方式部署,在这里主要对CentOS 6.5下采用 Nginx + fastcgi + Python + Django + PostgreSQL 的搭建与配置步骤做一个简要说明,主要留作备忘,也希望对大家有所帮助. 一.PostgreSQL.Django.Nginx安装 postgres.Djang

centos下多版本python及多开发环境的安装: pyenv&virtualenv

参考:  http://www.it165.net/pro/html/201405/13603.htmlhttp://www.it165.net/os/html/201405/8348.html 1. 安装 yum groupinstall "Development tools" yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm

Redhat Linux下的python版本升级

执行#Python与#python -V,看到版本号是2.4.3,很老了,而且之前写的都是跑在python3.X上面的,3.X和2.X有很多不同, 有兴趣的朋友可以参考下这篇文章: http://www.jb51.net/article/34011.htm 更新python千万不要把老版本的删除!新老版本是可以共存的,很多基本的命令. 软件包都要依赖预装的老版本python的,比如yum. 一.升级到2.7.3 1. 升级安装 首先下载源tar包 可利用linux自带下载工具wget下载,如下所

Centos下搭建 nginx+uwsgi+python

python做web应用最麻烦的还是配置服务器了,此话不假,光中间件就有好几种选择,fastcgi.wsgi.uwsgi,难 免让人眼花缭乱. 而听说uwsgi的效率是fastcgi和wsgi的10倍,因此初学python的我就有点跃跃欲试了,打算在centos下搭建个 nginx+uwsgi+python玩玩. 下面是本人经过google和亲身实践所得: 准备工作: yum install python-devel libxml2-devel python-setuptools zlib-de