将linux默认python升级到2.7.4版本
第一步:下载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
PCbuild
Python
RISCOS
Tools
config.sub
configure.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
PCbuild
Python
RISCOS
Tools
config.sub
configure.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变更后的名字)
将linux默认python升级到2.7.4版本的更多相关文章
- centos7里默认python升级到2.7.11
CentOS镜像使用帮助 http://mirrors.163.com/.help/centos.html 安装gcc yum install gcc* openssl openssl-devel ...
- Linux下python升级到python-2.7.13
下载python最新版本2.7.13并编译安装 wget https://www.python.org/ftp/python/2.7.12/Python-2.7.13.tar.xz xz -d Pyt ...
- Linux下python升级步骤
先安装openssl,openssl-devel yum install openssl yum install openssl-devel 1切换到指定的目录下: cd /usr/local 2下载 ...
- Linux下python升级
Centos即使用Yum更新也是Python2.6.6所以需要升级到Python2.7.8 1.先下载源码包 1 wget https://www.python.org/ftp/python/2.7. ...
- linux系统 python升级创建虚拟环境
Python3.3以上的版本通过venv模块原生支持虚拟环境,可以代替之前的virtualenv. 该venv模块提供了创建轻量级“虚拟环境”,提供与系统Python的隔离支持.每一个虚拟环境都有其自 ...
- Linux下python安装升级详细步骤 | Python2 升级 Python3
Linux下python升级步骤 Python2 ->Python3 多数情况下,系统自动的Python版本是2.x 或者yum直接安装的也是2.x 但是,现在多数情况下建议使用3.x 那么如 ...
- Linux下python安装升级详细步骤 | Python2 升级 Python3 转载
Linux下python升级步骤 Python2 ->Python3 多数情况下,系统自动的Python版本是2.x 或者yum直接安装的也是2.x 但是,现在多数情况下建议使用3.x 那么如 ...
- linux 安装python,pip,
Linux下python升级步骤 http://www.cnblogs.com/lanxuezaipiao/archive/2012/10/21/2732864.html 在 https://www. ...
- linux python2.x 升级python3.x
Linux下python升级步骤 Python2 ->Python3 多数情况下,系统自动的Python版本是2.x 或者yum直接安装的也是2.x 但是,现在多数情况下建议使用3.x 那么如 ...
随机推荐
- RMAN连接数据库
连接本地数据库: 方法1: C:\Documents and Settings\Administrator>set oracle_sid=jssweb C:\Documents and Sett ...
- 关于mybatis的参数2个使用经验(类似于struts2的通配所有页面的action配置,xmlsq语句参数类型为基本类型时的快捷指定办法)
1.我们都知道在struts2中为防止浏览器绕过struts过滤器直接请求页面,所以我们都会配置一个拦截所有页面的action,如下: <action name="*"> ...
- hql语句查询实体类采用list方法的返回结果集
在hibernate中,用hql语句查询实体类,采用list方法的返回结果为一个List,该List中封装的对象分为以下三种情况:1.查询全部字段的情况下,如"from 实体类", ...
- jquery冲突细节
使用jquery报一个错误,之前也遇到过,今天记录下来,方便以后使用 Uncaught TypeError: Object #<Object> has no method 'test' 这 ...
- 各种类型的Writable(Text、ByteWritable、NullWritable、ObjectWritable、GenericWritable、ArrayWritable、MapWritable、SortedMapWritable)转
java原生类型 除char类型以外,所有的原生类型都有对应的Writable类,并且通过get和set方法可以他们的值. IntWritable和LongWritable还有对应的变长VIntWri ...
- Angularjs之directive指令学习笔记(二)
1.Directive的五个实例知道driective作用.其中字段restrict.template. replace.transclude.link用法 参考文章链接地址:http://damoq ...
- maven相关
1. 创建/导入maven项目时 eclipse默认jdk版本配置:http://blog.csdn.net/lzj0470/article/details/42292021 2. eclipse 使 ...
- scrapy学习记录
scrapy是一个用来爬取一个或多个网站的数据,提取数据的应用框架.下载过程非常复杂,而且会遇到各种问题.所以写个博客来记录下. 安装好python2.7之后,就可以开始.安装scrapy前还需要安装 ...
- python logging 替代print 输出内容到控制台和重定向到文件
转自:http://blog.csdn.net/z_johnny/article/details/50740528
- 160907、CSS 预处理器-Less
CSS 预处理器是什么?一般来说,它们基于 CSS 扩展了一套属于自己的 DSL,来解决我们书写 CSS 时难以解决的问题: 语法不够强大,比如无法嵌套书写导致模块化开发中需要书写很多重复的选择器: ...