VPS 的 CentOS6 升级 Python 的方法

centos默认安装python2.6。由于python和centos关联紧密,所以不建议卸载,进行编译升级

1.新开的VPS务必系统更新

yum -y update

yum groupinstall -y development or; yum groupinstall -y 'development tools'

yum install -y zlib-dev zlib-devel  openssl-devel sqlite-devel bzip2-devel xz-libs



2.升级python>=2.7



编译参看: https://www.digitalocean.com/community/tutorials/how-to-set-up-python-2-7-6-and-3-3-3-on-centos-6-4

wget http://www.python.org/ftp/python/2.7.6/Python-2.7.6.tar.xz

wget http://www.python.org/ftp/python/3.3.3/Python-3.3.3.tar.xz

xz -d Python-2.7.6.tar.xz

tar -xvf Python-2.7.6.tar

xz -d Python-3.3.3.tar.xz

tar -xvf Python-3.3.3.tar



# Enter the file directory:

cd Python-2.7.6



# Start the configuration (setting the installation directory)

# By default files are installed in /usr/local.

# You can modify the --prefix to modify it (e.g. for $HOME).

./configure --prefix=/usr/local  



cd Python-3.3.3    

./configure



为了不覆盖系统默认选项 - 替换系统正在使用的PYTHON- 我们使用 make altinstall.



# Let's build (compile) the source

# This procedure can take awhile (~a few minutes)

make



# After building everything:

make altinstall



    Example for version 3.3.3:



make && make altinstall   # <--- Two commands joint together





我们直接进行

make

make install



3.建立软连接

编译的软件安装于 /usr/local/bin/python2.7

所以需要替换原来的 /usr/bin/python



mv /usr/bin/python /usr/bin/python2.6

rm /usr/bin/python

ln -s /usr/local/bin/python2.7 /usr/bin/python



vim /usr/bin/yum



/usr/bin/python 改成 /usr/bin/python2.6



4.更新 pip



https://bootstrap.pypa.io/get-pip.py

wget https://raw.github.com/pypa/pip/master/contrib/get-pip.py

python get-pip.py



ln -s /usr/local/bin/pip /usr/bin/pip



如果wget下载不了这文件,可能是DNS解析问题,需要下载个文件

vi /etc/resolv.conf

nameserver 8.8.4.4

nameserver 8.8.8.8

VPS 的 CentOS6 升级 Python 的方法的更多相关文章

  1. centos6升级python

    CentOS 6中,默认安装了Python 2.6.而pip,jupyter这样的常用工具是不支持Python 2.6的.为了使用这些工具,就必须将Python 2.6升级到Python 2.7以上的 ...

  2. centos6升级python版本至python3.5

    一. 从Python官网到获取Python3的包, 切换到目录/usr/local/src wget https://www.python.org/ftp/python/3.5.1/Python-3. ...

  3. CentOS升级Python的方法

    centOS内核版本为:3.10.101-1.el6.elrepo.x86_64 1,下载Python安装包 wget http://www.python.org/ftp/python/2.7.6/P ...

  4. CentOS6 系统下升级python后yum命令使用时报错

    CentOS6 系统下升级python后yum命令使用时报错,如下: [root@xxxxxxx]#yumFile"/usr/bin/yum",line30exceptKeyboa ...

  5. centos6.5升级python为2.7

    今天线上服务器全部升级python环境为python-2.7.6的环境,我采用的方法是ansible+shell,代码如下,友提,Python-2.7.6.tgz.setuptools-14.3.1. ...

  6. 升级python导致yum报错的解决方法

    把python从2.7升级到3.6后 , 使用yum报错 File ‘’/usr/bin/yum'', line 30 except KeyboardInterrupt, e: ^ 故障原因:yum采 ...

  7. 记一次centos6升级salt-minion启动失败的问题

    记一次centos6升级salt-minion启动失败的问题 作者:耀耀 blog:https://www.liuyao.me 一.起因 升级Salt-minion后 使用/etc/init.d/sa ...

  8. Linux 下编译升级 Python

    一.Centos下升级python3.4.3 1.下载安装 wget http://www.python.org/ftp/python/3.4.3/Python-3.4.3.tgz wget http ...

  9. 升级python到2.7版本pip不可用

    升级python到2.7版本pip不可用 [root@localhost pip-7.1.2]# pip Traceback (most recent call last): File "/ ...

随机推荐

  1. HTTP 协议基础及发展历史

    一. 5层网络模型介绍 低三层 物理层:主要作用是定义物理设备如何传输数据. 数据链路层:在通信的实体间建立数据链路连接. 网路层:为数据在结点之间传输创建逻辑链路. 传输层: 想用户提供可靠的端到端 ...

  2. Oracle 导入导出 创建用户等

    localhost:1158/emD:\app\Administrator\product\11.2.0\dbhome_1\bin\imp.exe log  path  E:\app\Administ ...

  3. WebAssembly学习(一):认识WebAssembly

    WebAssembly作为一门新兴起的技术,在 JavaScript 圈非常的火!人们都在谈论它多么多么快,怎样怎样改变 Web 开发领域,被各大巨头所推广,这篇文章对其做一个简单的了解认识,本文非原 ...

  4. idea和Pycharm 等系列产品激活激活方法和激活码

    引用自大神:雪中皓月原文链接 --------------------- 以下两种方法均可用于激活Idea,Pycharm等jetbrains系列产品第一种方法:使用现有的注册服务器优点:快捷,方便, ...

  5. Nginx安装与升级(包括虚拟主机)

    Nginx WEB服务器最主要就是各种模块的工作,模块从结构上分为核心模块.基础模块和第三方模块,其中三类模块分别如下: 核心模块:HTTP模块.EVENT模块和MAIL模块等: 基础模块:HTTP ...

  6. SpringBoot 增加 拦截器 判断是否登录

    1.创建拦截器 package com.example.demo.interceptor; import org.slf4j.Logger; import org.slf4j.LoggerFactor ...

  7. 11.2.0.1升级到11.2.0.4报错之中的一个:UtilSession failed: Patch 9413827

    UtilSession failed: Patch 9413827 requires component(s) that are not installed in OracleHome. These ...

  8. leetcode笔记:Sort Colors

    一. 题目描写叙述 Given an array with n objects colored red, white or blue, sort them so that objects of the ...

  9. 误操作 rpm -e --nodeps zlib

    误删缘由:目的是要升级ssh版本,结果好像是冥冥之中有股力量在作祟迫使我粘了一条致死的命令rpm -e --nodeps  zlib就执行了,奇怪的是执行之后根本就全然不知.最后在敲rpm命令时居然报 ...

  10. POJ 1989 贪心

    题意: 思路: 从前到后扫一遍 如果k个数都出现过了 ans++ 从当前接着判断 最后答案就是ans+1 //By SiriusRen #include <cstdio> using na ...