zoukankan      html  css  js  c++  java
  • liunx下在线升级python到2.7版本

    因开发nodejs中间用到了node-gyp模块,此模块需2.X最新版本,所以升级服务器python版本

    亲测成功

    python 升级步骤
    #1.which python 查询python的位置
    /usr/bin/python

    #2.cd到零时目录下载最新版本python 最下载地址可以到这里https://www.python.org/downloads/source/
    cd /opt
    wget https://www.python.org/ftp/python/2.7.13/Python-2.7.13.tgz

    #3 解压python
    tar -zxvf Python-2.7.13.tgz

    #4 cd到python的解压目录
    cd Python-2.7.13

    #5 在编译前先在/usr/local建一个文件夹python27(作为Python的安装路径,以免覆盖老的版本)
    mkdir /usr/local/python27

    #6在解压缩后的目录下编译安装
    ./configure --prefix=/usr/local/python27
    make
    make install

    #7此时没有覆盖老版本,再将原来/usr/bin/python链接改为别的名字
    mv /usr/bin/python /usr/bin/python_old

    #8再建立新版本python的链接
    ln -s /usr/local/python27/bin/python2.7 /usr/bin/python

    #输入python可以看到安装成功
    #Python 2.7.13 (default, Aug 24 2017, 15:47:17)
    #[GCC 4.4.7 20120313 (Red Hat 4.4.7-18)] on linux2
    #Type "help", "copyright", "credits" or "license" for more information.

  • 相关阅读:
    游标cursor
    SQL: EXISTS
    LeetCode Reverse Integer
    LeetCode Same Tree
    LeetCode Maximum Depth of Binary Tree
    LeetCode 3Sum Closest
    LeetCode Linked List Cycle
    LeetCode Best Time to Buy and Sell Stock II
    LeetCode Balanced Binary Tree
    LeetCode Validate Binary Search Tree
  • 原文地址:https://www.cnblogs.com/xiashan17/p/7423562.html
Copyright © 2011-2022 走看看