当前位置: 首页 > news >正文

python入门系列之一:Centos6下python2.7的安装

1)编译安装python2.7

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
[root@mysql-master ~] # python -V
Python 2.6.6
查看python的版本信息(之前的yum是通过yum安装的)
[root@mysql-master src] # wget https://www.python.org/ftp/python/2.7.9/Python-2.7.9.tar.xz
[root@mysql-master src] # file Python-2.7.9.tar.xz 
Python-2.7.9. tar .xz: xz compressed data
[root@mysql-master src] # xz -d Python-2.7.9.tar.xz 
[root@mysql-master src] # ls
debug  kernels  Python-2.7.9. tar
[root@mysql-master src] # tar -xf Python-2.7.9.tar 
[root@mysql-master src] # cd Python-2.7.9
[root@mysql-master Python-2.7.9] # ./configure 
[root@mysql-master Python-2.7.9] # make && make install
[root@mysql-master Python-2.7.9] # echo $?
0
[root@mysql-master Python-2.7.9] # /usr/local/bin/python2.7 -V
Python 2.7.9
[root@mysql-master Python-2.7.9] # mv /usr/bin/python /usr/bin/python2.6
mv :是否覆盖 "/usr/bin/python2.6" ?  yes
[root@mysql-master Python-2.7.9] # ln -s /usr/local/bin/python2.7 /usr/bin/python
[root@mysql-master Python-2.7.9] # python -V
Python 2.7.9

2)调整yum的配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
因为yum使用会调用python的信息,避免重新安装python后,yum出现报错,编辑yum的文件:
[root@mysql-master Python-2.7.9] # sed -i 's@#!/usr/bin/python@#!/usr/bin/python2.6@g' /usr/bin/yum
[root@mysql-master Python-2.7.9] # cat /usr/bin/yum |head
#!/usr/bin/python2.6
import  sys
try:
     import  yum
except ImportError:
     print >> sys.stderr,  "" "\
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:
    %s
[root@mysql-master Python-2.7.9] # python
Python 2.7.9 (default, Nov 16 2016, 19:53:47) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-16)] on linux2
Type  "help" "copyright" "credits"  or  "license"  for  more  information.
>>> print  "hello,world"
hello,world
到此,python2.7的基本安装也完成了。









本文转自 冰冻vs西瓜 51CTO博客,原文链接:http://blog.51cto.com/molewan/1873670,如需转载请自行联系原作者

相关文章:

  • Skype For Business 2015实战系列19:统一通讯之配置Exchange 2013 SP1
  • nginx部署
  • redhat 6.5 配置WAS控制台中文
  • filebeat 配置文件详解
  • windows用户和组及其权限的设置
  • 磁盘安装启动的方法与ASM
  • MySQL解析器源码分析--对select语句中子查询处理逻辑的分析(一)
  • 使用.net 2.0开发多层架构的系统之一——本网站2006-10-01版本源代码公布
  • Day18 Django的深入使用
  • 谁还原了你的数据库?
  • 根据MAC地址查询IP地址
  • 安装配置samba服务器和客户端
  • 数据结构—队列
  • 多核编程的四层境界
  • 理论与现实的距离
  • ComponentOne 2017 V2版本正式发布
  • crontab执行失败的多种原因
  • ESLint简单操作
  • Fastjson的基本使用方法大全
  • Git的一些常用操作
  • HTML-表单
  • JavaScript 一些 DOM 的知识点
  • JavaScript标准库系列——Math对象和Date对象(二)
  • React-redux的原理以及使用
  • spring学习第二天
  • Travix是如何部署应用程序到Kubernetes上的
  • vagrant 添加本地 box 安装 laravel homestead
  • 深入浅出webpack学习(1)--核心概念
  • 收藏好这篇,别再只说“数据劫持”了
  • 通过获取异步加载JS文件进度实现一个canvas环形loading图
  • ​html.parser --- 简单的 HTML 和 XHTML 解析器​
  • # .NET Framework中使用命名管道进行进程间通信
  • # 计算机视觉入门
  • $.each()与$(selector).each()
  • (04)Hive的相关概念——order by 、sort by、distribute by 、cluster by
  • (1)(1.9) MSP (version 4.2)
  • (10)ATF MMU转换表
  • (39)STM32——FLASH闪存
  • (rabbitmq的高级特性)消息可靠性
  • (多级缓存)多级缓存
  • (附源码)spring boot基于Java的电影院售票与管理系统毕业设计 011449
  • (十八)用JAVA编写MP3解码器——迷你播放器
  • (一)硬件制作--从零开始自制linux掌上电脑(F1C200S) <嵌入式项目>
  • (转)shell中括号的特殊用法 linux if多条件判断
  • (转)如何上传第三方jar包至Maven私服让maven项目可以使用第三方jar包
  • *_zh_CN.properties 国际化资源文件 struts 防乱码等
  • .NET Windows:删除文件夹后立即判断,有可能依然存在
  • .NET 中 GetProcess 相关方法的性能
  • .NET框架设计—常被忽视的C#设计技巧
  • .net流程开发平台的一些难点(1)
  • .NET企业级应用架构设计系列之应用服务器
  • @RequestParam详解
  • @vue/cli脚手架
  • [Angular] 笔记 18:Angular Router
  • [BSGS算法]纯水斐波那契数列