CentOS 6 RPM安裝python 2.7

时间:2021-12-15 00:10:35

先说第一种方法,通过rpmbuild编译XXX.src.rpm包([1]、[2]):

  1. 安装依赖:sudo yum install -y make autoconf bzip2-devel db4-devel expat-devel gcc-c++ gdbm-devel glibc-devel gmp-devel libffi-devel libGL-devel libX11-devel ncurses-devel openssl-devel readline-devel sqlite-devel systemtap-sdt-devel tcl-devel tix-devel tk-devel valgrind-devel zlib-devel
  2. 下载src.rpm: ftp://ftp.pycopia.org/pub/python/RHEL51/python2.7-2.7.1-1TH.src.rpm
  3. sudo rpmbuild –rebuild

然后等待漫长的编译过程。

……

……

……

在此期间我宣布一下实验结果:编译+tests跑了1个多小时,最后告诉我打包rpm时出错!坑爹啊!!

第二种是懒人大法,直接下载二进制rpm包安装:

  1. http://li.nux.ro/download/nux/dextop/el6/x86_64/python27-libs-2.7.3-6.2.el6.nux.x86_64.rpm
  2. http://li.nux.ro/download/nux/dextop/el6/x86_64/python27-2.7.3-6.2.el6.nux.x86_64.rpm
  3. http://li.nux.ro/download/nux/dextop/el6/x86_64/tkinter27-2.7.3-6.2.el6.nux.x86_64.rpm
  4. http://li.nux.ro/download/nux/dextop/el6/x86_64/python27-devel-2.7.3-6.2.el6.nux.x86_64.rpm

如果只需要python可以只安装1和2,不过通常未来安装python库时有时会需要头文件,所以一般推荐也安装上python27-devel.

作者:肖斌
本文链接:https://xiaobin.net/201303/centos-6-install-python-2-7-via-rpm/