将linux默认python升级到2.7.4版本 (2013-05-25 23:21:09)转载▼
标签: linux python 升级 centos python2.7 分类: python
第一步:下载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变更后的名字)

checking for gcc... no相关推荐

  1. linux卸载mpfr,Red Hat Linux在安装gcc时遇到的问题汇总

    找到了一个比较老的RedHatlinux,想要装上apache+tomcat.由于是在虚拟机中运行,我想先装一个vmware-tools提高性能. 但是安装的过程中我发现竟然找不到gcc.于是我就去网 ...

  2. linux fedor 安装 gcc,fedora中如何安装gccsense

    该楼层疑似违规已被系统折叠 隐藏此楼查看此楼 有在fedora中安装过gccsense的吗? manual里面只有debian freeBSD Mac的安装前准备 没有feodra的 ./config ...

  3. gcc选项 和 gdb 使用

    CC 编译详解 GNU CC(简称为Gcc)是GNU项目中符合ANSI C标准的编译系统,能够编译用C.C++和Object C等语言编写的程序.Gcc不仅功能强大,而且可以编译如C.C++.Obje ...

  4. linux2.6 gcc 4.8.2,在Red Hat Enterprise linux 6.5上安装GCC 4.8.2

    我是Red Hat Enterprise linux的新手.我在Red Hat Enterprise Linux 6.5上编译gcc 4.8.2时面临问题;我从GNU webite中获取源代码.我按照 ...

  5. CentOS6 安装gcc编译器,解决【configure: error: no acceptable C compiler found in $PATH】问题

    前言: 编译文件 ntfs-3g_ntfsprogs-2021.8.22 时报缺少C编译器错误,所以需要安装gcc编译器.绿色字体标注即是错误提示. [root@localhost ntfs-3g_n ...

  6. 解决麒麟系统arm环境无法安装pyinstaller的错误:Checking for library z : not found

    错误信息如下: [root@ecs-6af3 ~]# pip3 install pyinstaller==4.0 WARNING: Running pip install with root priv ...

  7. linux下编译isl,GCC编译器升级./configure报错“configure: error: Unable to find a usable ISL.”解决办法...

    现象: GCC编译器升级时,./configure报错"configure: error: Unable to find a usable ISL. See config.log for d ...

  8. 【教程】制作能在ARM板上直接运行的gcc本地编译器

    编译好的程序的下载链接:百度网盘 请输入提取码(提取码:ocmm) 概述 通常情况下,我们是在电脑里面开一个Linux虚拟机, 在虚拟机里面用交叉编译工具链编译好可执行文件后,将可执行文件拷贝到板子里 ...

  9. linux编程GCC、gdb、Makefile、make、

    文章目录 GCC gcc编译过程 gcc编译多文件 gdb 动态库和静态库 创建静态库 使用静态库 动态库 动态库的创建 动态库的使用 静态库和动态库的区别 make make是什么 1 make命令 ...

最新文章

  1. 7篇Nature,2篇Science!这所985高校迎来顶刊大丰收
  2. [实战]MVC5+EF6+MySql企业网盘实战(16)——逻辑重构3
  3. [leetcode-61-Rotate List]
  4. springboot获取getBean方法以及ApplicationContext空指针问题解决
  5. BERT小学生级上手教程,从原理到上手全有图示,还能直接在线运行
  6. python手机版iphone-Python编程神器
  7. 用html修改游戏聊天字体,前端使用自定义字体方案
  8. python如何修改excel数据库_python修改excel数据库
  9. 【框架学习分享】HttpRunner
  10. metinfo mysql off_利用Sqlmap测试MetInfo企业网站管理系统MySql注入漏洞
  11. linux防火墙能阻止cc攻击吗,linux csf 防火墙 防止少量的ddos cc攻击很有效
  12. 极光笔记 | 极光clickhouse千亿级数据分析实践之路
  13. 迅雷下载链接转为普通链接
  14. Android仿微信语音录制和播放
  15. AOP名词解释Advice,Pointcut,Advisor,Joinpoint,Advised是什么?
  16. 肖sir__出现无法连接仓库的情况:Error performing git command: git ls-remote -h
  17. 全球及中国雾化铜和铜合金粉末行业产销需求及发展动态分析报告2022-2028年
  18. PgSQL · 乱入拜年 · 小鸡吉吉和小象Pi吉(PostgreSQL)的鸡年传奇
  19. win10修改桌面图标大小
  20. (读书笔记)大数据分析计算机基础

热门文章

  1. 从动网论坛的衰落谈技术与运营的关系
  2. 用C语言多线程描述哲学家,C语言多线程之“哲学家就餐”问题
  3. 微信小程序天气查询功能--使用高德开放平台接口
  4. 常见的服务器架构入门:从单体架构、EAI 到 SOA 再到微服务和 ServiceMesh
  5. Binder之AIDL进程间通信的使用(附源码)
  6. 网络安全职业_我如何开始网络安全职业
  7. 在SpringBoot中启用Http2.0
  8. 把握云计算+引领云时代
  9. 使用barrier共享键鼠
  10. 利用 Travis CI 把 Android 项目部署到 github