|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
小知识:Linux是一套免费使用和自由传播的类Unix操作系统。
centos体系默许给装的是python2.4,因而先把python升到2.7.5吧。
参考的:http://gavinshaw.blog.51cto.com/385947/610585
下载新版本的python
1:[root@wangyuelou~]#wgethttp://python.org/ftp/python/2.7.2/Python-2.7.2.tgz
解紧缩和编译
1:[root@wangyuelou~]#tarxvfPython-2.7.2.tar.bz2
2:[root@wangyuelouPython-2.7.2]#./configure--prefix=/usr/local/python27
3:[root@wangyuelouPython-2.7.2]#make
4:[root@wangyuelouPython-2.7.2]#makeinstall
5:[root@wangyuelouPython-2.7.2]#ls/usr/local/python27/-al
6:total28
7:drwxr-xr-x6rootroot4096Jul1400:21.
8:drwxr-xr-x20rootroot4096Jul1400:17..
9:drwxr-xr-x2rootroot4096Jul1400:21bin
10:drwxr-xr-x3rootroot4096Jul1400:21include
11:drwxr-xr-x4rootroot4096Jul1400:21lib
12:drwxr-xr-x3rootroot4096Jul1400:21share
笼罩本来的python链接
1:[root@wangyuelouPython-2.7.2]#mv/usr/bin/python/usr/bin/python_old
2:[root@wangyuelouPython-2.7.2]#ln-s/usr/local/python27/bin/python/usr/bin/
3:[root@wangyuelouPython-2.7.2]#python
4:Python2.7.2(default,Jul142011,00:20:14)
5:[GCC4.1.220080704(RedHat4.1.2-50)]onlinux2
6:Type"help","copyright","credits"or"license"formoreinformation.
7:>>>
此处曾经可以正常应用python2.7了
然则由于yum是应用的2.4的版原来用的,所以还须要修正一下
1:[root@wangyuelou~]#yum
2:TherewasaproblemimportingoneofthePythonmodules
3:requiredtorunyum.Theerrorleadingtothisproblemwas:
4:
5:Nomodulenamedyum
6:
7:Pleaseinstallapackagewhichprovidesthismodule,or
8:verifythatthemoduleisinstalledcorrectly.
9:
10:Itspossiblethattheabovemoduledoesntmatchthe
11:currentversionofPython,whichis:
12:2.7.2(default,Jul142011,00:20:14)
13:[GCC4.1.220080704(RedHat4.1.2-50)]
14:
15:Ifyoucannotsolvethisproblemyourself,pleasegoto
16:theyumfaqat:
17:http://wiki.linux.duke.edu/YumFaq
18:
19:
20:[root@wangyuelouPython-2.7.2]#vim/usr/bin/yum
21:
22:#!/usr/bin/python#修正此处为2.4的地位
23:[root@wangyuelou~]#vim/usr/bin/yum
24:
25:#!/usr/bin/python2.4
26:[root@wangyuelou~]#yum
27:Loadedplugins:fastestmirror
28:Youneedtogivesomecommand
29:usage:yum[options]COMMAND
30:
31:ListofCommands:
32:
33:check-updateCheckforavailablepackageupdates
34:cleanRemovecacheddata
35:deplistListapackagesdependencies
36:downgradedowngradeapackage
37:eraseRemoveapackageorpackagesfromyoursystem
38:groupinfoDisplaydetailsaboutapackagegroup
39:groupinstallInstallthepackagesinagrouponyoursystem
40:grouplistListavailablepackagegroups
41:groupremoveRemovethepackagesinagroupfromyoursystem
42:helpDisplayahelpfulusagemessage
43:infoDisplaydetailsaboutapackageorgroupofpackages
44:installInstallapackageorpackagesonyoursystem
45:listListapackageorgroupsofpackages
46:localinstallInstallalocalRPM
yum又可使用了
弥补点:
看来新装的版本失效了,做个软衔接应当就OK。
mv/usr/bin/python/usr/bin/python-bak
ln-s/usr/local/bin/python3.0/usr/bin/python
进级装置好今后yum会没法应用,由于yum应用的是2.4版本的,所以要修正yum的设置装备摆设文件以便可以或许辨认2.4版本下的python
vim/usr/bin/yum
将文件头部的
#!/usr/bin/python
改成
#!/usr/bin/python2.4
就能够持续应用yum了
小知识:CentOS并不包含封闭源代码软件。 |
|