码迷,mamicode.com
首页 > 编程语言 > 详细

linux系统将python升级到2.7.10版本

时间:2017-06-02 11:22:45      阅读:322      评论:0      收藏:0      [点我收藏+]

标签:cat   软连接   文件中   linux系统   2.7   extend   profile   ble   pad   

linux系统将python升级到2.7.10版本

下载地址:

https://www.python.org/ftp/python/2.7.10/Python-2.7.10.tgz

 

  1. 下载文件到指定目录

[root@operations ~]# cd /usr/local/

[root@operations local]# wget https://www.python.org/ftp/python/2.7.10/Python-2.7.10.tgz

--19:12:59--  https://www.python.org/ftp/python/2.7.10/Python-2.7.10.tgz

Resolving www.python.org... 103.245.222.223

Connecting to www.python.org|103.245.222.223|:443... connected.

ERROR: cannot verify www.python.org‘s certificate, issued by `/C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert SHA2 Extended Validation Server CA‘:

  Unable to locally verify the issuer‘s authority.

To connect to www.python.org insecurely, use `--no-check-certificate‘.

Unable to establish SSL connection.

注:建立连接失败,原因是目标网站证书不可用,使用`--no-check-certificate‘进行忽略。

[root@operations local]# wget https://www.python.org/ftp/python/2.7.10/Python-2.7.10.tgz --no-check-certificate

 

2. 解压文件

[root@operations local]# tar zxvf Python-2.7.10.tgz

[root@operations local]# ls |grep Python

Python-2.7.10

Python-2.7.10.tgz

 

3. 安装

[root@operations local]# cd Python-2.7.10

[root@operations Python-2.7.10]# ls

aclocal.m4    Demo        Lib              Modules  pyconfig.h.in  Tools

config.guess  Doc         LICENSE          Objects  Python

config.sub    Grammar     Mac              Parser   README

configure     Include     Makefile.pre.in  PC       RISCOS

configure.ac  install-sh  Misc             PCbuild  setup.py

[root@operations local]# cd Python-2.7.10

[root@operations Python-2.7.10]# ./configure --prefix=/usr/local/python2.7.10

[root@operations Python-2.7.10]# make && make install

 

4. 更新系统环境变量

[root@operations ~]# cd /usr/local/Python-2.7.10

[root@operations Python-2.7.10]# cd ../python2.7.10/

[root@operations python2.7.10]# ll

total 16

drwxr-xr-x 2 root root 4096 Aug 23 20:34 bin

drwxr-xr-x 3 root root 4096 Aug 23 20:34 include

drwxr-xr-x 4 root root 4096 Aug 23 20:34 lib

drwxr-xr-x 3 root root 4096 Aug 23 20:34 share

[root@operations python2.7.10]# python -V  

Python 2.4.3   [目前还是2.4.3版本]

[root@operations python2.7.10]# whereis python

python: /usr/bin/python /usr/bin/python2.4 /usr/lib/python2.4 /usr/include/python2.4 /usr/share/man/man1/python.1.gz

方法1:

[root@operations python2.7.10]# mv /usr/bin/python /usr/bin/python2.4.3

在/etc/profile文件中添加以下两行

PATH=$PATH:/usr/local/python2.7.10/bin

export PATH

[root@operations python2.7.10]# . /etc/profile

[root@operations python2.7.10]# python -V

Python 2.7.10

 

方法2:设置软连接

[root@operations python2.7.10]# mv /usr/bin/python /usr/bin/python2.4.3

[root@operations profile.d]# ln -s /usr/local/python2.7.10/bin/python /usr/bin/python

[root@operations profile.d]# ll /usr/bin/python

lrwxrwxrwx 1 root root 34 Aug 23 20:43 /usr/bin/python -> /usr/local/python2.7.10/bin/python

[root@operations profile.d]# python -V

Python 2.7.10

linux系统将python升级到2.7.10版本

标签:cat   软连接   文件中   linux系统   2.7   extend   profile   ble   pad   

原文地址:http://www.cnblogs.com/xiaoermaomao/p/6931945.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!