发布时间:2022-06-29 文章分类:编程知识 投稿人:赵颖 字号: 默认 | | 超大 打印

CentOS安装python2.6

分类: python 60人阅读 评论(0) 收藏 举报

目前很多主机都用CentOS,这个上面默认的Python是2.4。 手动安装python2.6很麻烦,继续装什么pymssql之类的东东又会花很长时间。寻觅了好久,终于找到了一个好的办法:

系统:CentOS 5.3、5.4 。 有网络。

按如下操作:

[plain] view plaincopyprint?

  1. rpm-Uvhhttp://yum.chrislea.com/centos/5/i386/chl-release-5-3.noarch.rpm
  2. rpm--import/etc/pki/rpm-gpg/RPM-GPG-KEY-CHL
  3. yuminstallpython26
rpm -Uvh http://yum.chrislea.com/centos/5/i386/chl-release-5-3.noarch.rpm
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CHL
yum install python26

果出现"Error: Missing Dependency: libffi.so.5 is needed by package python26-2.6.2-2.i386 (chl)"的错误就做出下操作

[plain] view plaincopyprint?

  1. wgetftp://ftp.pbone.net/mirror/centos.karan.org/el5/extras/testing/i386/RPMS/libffi-3.0.5-1.el5.kb.i386.rpm
  2. rpm-ilibffi-3.0.5-1.el5.kb.i386.rpm
wget ftp://ftp.pbone.net/mirror/centos.karan.org/el5/extras/testing/i386/RPMS/libffi-3.0.5-1.el5.kb.i386.rpm
rpm -i libffi-3.0.5-1.el5.kb.i386.rpm

然后再yum install python26 就安装完成了。

接下来安装Setuptools 0.6c11

[plain] view plaincopyprint?

  1. wgethttp://pypi.python.org/packages/2.6/s/setuptools/setuptools-0.6c11-py2.6.egg#md5=bfa92100bd772d5a213eedd356d64086
  2. shsetuptools-0.6c11-py2.6.egg
wget http://pypi.python.org/packages/2.6/s/setuptools/setuptools-0.6c11-py2.6.egg#md5=bfa92100bd772d5a213eedd356d64086
sh setuptools-0.6c11-py2.6.egg

如果需要python 的devel 就 yum install python26-devel