python2.4对应linux哪个版本

Python010

python2.4对应linux哪个版本,第1张

第一步:下载python2.7.4版本源码:

wget http://python.org/ftp/python/2.7.4/Python-2.7.4.tgz

解压文件

[aa@localhost ~]$ tar jxvf Python-2.7.4.tar.bz2

[niuxl@localhost ~]$ cd Python-2.7.4

[niuxl@localhost Python-2.7.4]$ ls

config.guess configure Demo Grammar install-sh LICENSE Makefile.pre.in Modules Parser PCbuildPython RISCOSTools

config.subconfigure.ac Doc Include Lib Mac Misc Objects PC pyconfig.h.in README setup.py

[niuxl@localhost Python-2.7.4]$ su -

口令:

[root@localhost ~]# mkdir /usr/local/python2.7.4

[root@localhost ~]# cd /home/

[root@localhost home]# cd niuxl/Python-2.7.4

[root@localhost Python-2.7.4]# ls

config.guess configure Demo Grammar install-sh LICENSE Makefile.pre.in Modules Parser PCbuildPython RISCOSTools

config.subconfigure.ac Doc Include Lib Mac Misc Objects PC pyconfig.h.in README setup.py

编译之前,需要先安装zlib包:

[root@localhost Python-2.7.4]# yum install zlib zlib-devel

[root@localhost Python-2.7.4]# ./configure --prefix=/usr/local/python2.7.4

checking build system type... i686-pc-linux-gnu

checking host system type... i686-pc-linux-gnu

checking for --enable-universalsdk... no

checking for --with-universal-archs... 32-bit

checking MACHDEP... linux2

checking EXTRAPLATDIR...

checking for --without-gcc... no

checking for gcc... no

checking for cc... no

checking for cl.exe... no

configure: error: in `/home/niuxl/Python-2.7.4':

configure: error: no acceptable C compiler found in $PATH

缺少c编辑器

安装c编辑器:

[root@localhost Python-2.7.4]# yum install gcc

..略

注:有一个选择y和n的地方,提示是否继续下载,输入y,回车即可!

gcc安装完成

继续编译python

[root@localhost Python-2.7.4]# ./configure --prefix=/usr/local/python2.7.4

..(略)

ok编译成功

[root@localhost Python-2.7.4]# make &&make install

安装成功

[root@localhost Python-2.7.4]# python -V

Python 2.4.3

目前版本依然是2.4.3,现在开始升级python,

查看python命令所在目录

[root@localhost Python-2.7.4]# whereis python

python: /usr/bin/python2.4 /usr/bin/python /usr/lib/python2.4 /usr/include/python2.4 /usr/share/man/man1/python.1.gz

将/usr/bin/python 的软连接修改为python2.4.3

[root@localhost Python-2.7.4]# mv /usr/bin/python /usr/bin/python2.4.3

[root@localhost Python-2.7.4]# python

-bash: /usr/bin/python: 没有那个文件或目录

python命令找不到,这时只需要将版本python2.7.4命令加入环境变量即可!

方式1:

修改/etc/profile加入如下两行:

PATH=$PATH:/usr/local/python2.7.4/bin

export PATH

然后

[root@localhost Python-2.7.4]# source /etc/profile

[root@localhost Python-2.7.4]# python -V

Python 2.7.4

当然也可以创建2.7.4版本的python的软连接:/usr/bin/python

[root@localhost ~]# ln -s /usr/local/python2.7.4/bin/python /usr/bin/python

亦可

ok,python升级完成

到现在为止,还有最后一件事需要做,那就是yum与python的兼容问题:

[root@localhost pipe]# vi /usr/bin/yum

#!/usr/bin/python

第一行修改为

#!/usr/bin/python2.4.3(即原始的python变更后的名字)

Python的所有版本发布时间如下:

Python 3.3.2发布于2013年5月15日。

Python 3.2.5发布于2013年5月15日。

Python 3.1.5发布于2012年4月10日。

Python 3.0.1发布于2009年2月13日。

Python 2.7.5发布于2013年5月15日。

Python 2.6.8发布于2012年4月10日。

Python 2.5.6发布于2011年5月26日。

Python 2.4.6发布于2008年12月19日。

Python 2.3.7发布于2008年3月11日。

Python 2.2.3发布于2003年5月30日。

Python 2.1.3发布于2002年4月8日。

Python 2.0.1发布于2001年6。

Python 1.6.1发布于2000年9月。

Python 1.5.2发布于1999年4月。

Python的创始人为荷兰人吉多·范罗苏姆 (Guido van Rossum)。1989年圣诞节期间,在阿姆斯特丹,Guido为了打发圣诞节的无趣,决心开发一个新的脚本解释程序,作为ABC 语言的一种继承。

之所以选中Python(大蟒蛇的意思)作为该编程语言的名字,是取自英国20世纪70年代首播的电视喜剧《蒙提.派森的飞行马戏团》(Monty Python's Flying Circus)。

ABC是由Guido参加设计的一种教学语言。就Guido本人看来,ABC 这种语言非常优美和强大,是专门为非专业程序员设计的。

但是ABC语言并没有成功,究其原因,Guido 认为是其非开放造成的。Guido 决心在Python 中避免这一错误。同时,他还想实现在ABC 中闪现过但未曾实现的东西。

就这样,Python在Guido手中诞生了。可以说,Python是从ABC发展起来,主要受到了Modula-3(另一种相当优美且强大的语言,为小型团体所设计的)的影响。并且结合了Unix shell和C的习惯。

扩展资料

Python的设计哲学是“优雅”、“明确”、“简单”。因此,Perl语言中“总是有多种方法来做同一件事”的理念在Python开发者中通常是难以忍受的。Python开发者的哲学是“用一种方法,最好是只有一种方法来做一件事”。

在设计Python语言时,如果面临多种选择,Python开发者一般会拒绝花俏的语法,而选择明确的没有或者很少有歧义的语法。

由于这种设计观念的差异,Python源代码通常被认为比Perl具备更好的可读性,并且能够支撑大规模的软件开发。这些准则被称为Python格言。在Python解释器内运行import this可以获得完整的列表。

参考资料:

百度百科--Python