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

centos 编译安装 python

时间:2016-04-29 20:18:12      阅读:152      评论:0      收藏:0      [点我收藏+]

标签:centos python 安装

1、下载源码

    wget https://www.python.org/ftp/python/2.7.11/Python-2.7.11.tgz

2、解压

    tar zxvf Python-2.7.11.tgz

3、安装

    cd Python-2.7.11

     ./configure --prefix=/usr/local/python27

    make && make install

4、修改系统默认python,并更新

    mv /usr/bin/python /usr/bin/python2.6.old

    ln -s /usr/local/python27/bin/python2.7 /usr/bin/python

5、检测

    python -V,显示2.7.11

6、更改yum解释器

    由于yum使用python解释器,输入命令yum list,显示

    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


    vi /usr/bin/yum

    将文件头部的#!/usr/bin/python改为#!/usr/bin/python2.6


本文出自 “linux基础” 博客,请务必保留此出处http://chaoyuezhangsan.blog.51cto.com/7176886/1768998

centos 编译安装 python

标签:centos python 安装

原文地址:http://chaoyuezhangsan.blog.51cto.com/7176886/1768998

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