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

SUSE10 SP4源码升级Python到2.6.6

时间:2015-10-14 13:58:35      阅读:181      评论:0      收藏:0      [点我收藏+]

标签:

1.安装依赖包(CentOS可采用yum)

zypper in gcc gcc-c++ openssl-devel-32bit openssl-devel readline-devel readline-devel-32bit sqlite-devel tk tk-32bit  tk-devel

2.下载Python源码包

cd /usr/src/
wget
https://www.python.org/ftp/python/2.6.6/Python-2.6.6.tgz

3.编译安装

cd /usr/src/
tar zxvf Python-2.6.6.tgz
cd Python-2.6.6
./configure --prefix=/usr/local/python2.6.6 
make 
make install

4.替换旧版本Python

查看旧版本Python命令路径

which python

这里为/usr/local/bin/python

进行版本替换

mv /usr/local/bin/python /usr/local/bin/python.bak
ln -s /usr/local/python2.6.6/bin/python2.6 /usr/local/bin/python
echo "export PATH=$PATH:/usr/local/python2.6.6/bin/" >> /etc/profile
source /etc/profile

5.验证

执行“python”命令,无报错即证明安装完成

##############以上即完成python的升级###############

注:

  1.升级python不要删除原有版本

  2.执行make完成后提示如下fails:  

Python build finished, but the necessary bits to build these modules were not found:
   _bsddb             _sqlite3           _ssl
   _tkinter           bsddb185           bz2
   dbm                gdbm               readline
   sunaudiodev
To find the necessary bits, look in setup.py in detect_modules() for the modules name.

  处理方法:参见本文“1.安装依赖包(CentOS可采用yum)”

  参考链接:http://blog.useasp.net/archive/2014/05/07/compile-and-install-python-2-dot-7-dot-6-on-centos.aspx

  3.CentOS源码升级python方法基本同上,升级完成后yum将不可用,修复yum方法:

    编辑/usr/bin/yum,修改#!/usr/bin/python为#!/usr/bin/python2.4(原版本)。

  4.执行python命令,报错“import readline ImportError: No module named readline”处理方法:

    安装readline-devel即可。

 

SUSE10 SP4源码升级Python到2.6.6

标签:

原文地址:http://www.cnblogs.com/jim-hwg/p/4877019.html

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