linux系统将python升级到2.7.10版本
2015-08-24 10:34
701 查看
下载地址:
https://www.python.org/ftp/python/2.7.10/Python-2.7.10.tgz
下载文件到指定目录
[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
https://www.python.org/ftp/python/2.7.10/Python-2.7.10.tgz
下载文件到指定目录
[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命令: cut命令的使用方法
- 通过COM口管理LINUX服务器
- Linux总提示“You have new mail in /var/spool/mail/root”
- Androi--Linux下的常用命令行
- linux上ln命令详细说明
- Linux 4.0的驱动开发读书笔记之驱动的概述
- linux sed 命令
- Linux内核监控模块-0-开篇简介
- CentOS6.5+LAMP+YAF
- linux
- 如何在 Linux 终端中知道你的公有 IP
- linux 创建NFS服务
- 【Red Hat Linux基础】 磁盘分区详细教程
- [Linux 运维] pv,vg和lv的概念
- linux时间的更改
- linux 7z命令交叉编译移植到arm linux平台
- Centos6.6在Vmware下全屏
- linux通过wget直接下载jdk,避免用户验证
- Linux时间子系统之(三):用户空间接口函数
- Linux系统下g++的安装方法