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. 分享一个vue中的vue-Resource用法

    //引入 <script src="//cdn.bootcss.com/vue-resource/1.2.1/vue-resource.js" type="text ...

  2. NOIP 模拟赛

    NOIP 模拟赛 思路:求 n , m 的 gcd,然后用 n , m 分别除以 gcd:若 n 或 m 为偶数,则输出 1/2. 特别的,当 n = m = 1 时,应输出 1/1 #include ...

  3. ORACLE-016:ora-01720 授权选项对于&#39;xxxx&#39;不存在

    报错的情形例如以下. A用户:视图V_A B用户:视图V_B,而且用到了V_A C用户:须要用V_B, 授权过程, A用户下: grant select on V_A to B B用户下: grant ...

  4. DbVisualizer Personal 中文乱码问题的通用解决方法

    在SQL Commander中,sql语句中假设有中文.显示是口. 解决的方法例如以下: 在Tools->Tool Properties->General->Appearance-& ...

  5. a标签中的javascript:;是什么

    a标签中的javascript:;是什么 一.问题 <a>标签中href="javascript:;"表示什么意思?? <a id="jsPswEdit ...

  6. 使用Java语言开发微信公众平台(三)

            在上一节课程中,我们来学习了微信公众平台最基础的一个接口——access_token,并且能够从微信公众平台中取到access_token. 那么,在本节课程中,我们要以上节课获取到的 ...

  7. bash命令集---文件的操作

    git bash命令集: clear:清除窗口中的内容 ls touch cat more head tail mv cp rm diff chmod gzip gunzip gzcat lpr lp ...

  8. BZOJ3994: [SDOI2015]约数个数和(莫比乌斯反演)

    Description  设d(x)为x的约数个数,给定N.M,求     Input 输入文件包含多组测试数据. 第一行,一个整数T,表示测试数据的组数. 接下来的T行,每行两个整数N.M. Out ...

  9. ssh-agent && 及 ssh-add介绍

    ssh-agent命令是一种控制用来保存公钥身份验证所使用的私钥的程序.ssh-agent在X会话或登录会话之初启动,所有其他窗口或程序则以客户端程序的身份启动并加入到ssh-agent程序中.通过使 ...

  10. windows10系统window键失灵,没有反应

    今天键盘的的Window键(win键)按了没反应,某度一圈全是它的垃圾营销号文章,没卵用..最后在微软官方社区支持找到解决方案.也建议大家遇到系统问题到微软社区去寻求帮助,毕竟人家是专业. 解决办法 ...