linux系统将python升级到2.7.10版本
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了linux系统将python升级到2.7.10版本相关的知识,希望对你有一定的参考价值。
linux系统将python升级到2.7.10版本
下载地址:
https://www.python.org/ftp/python/2.7.10/Python-2.7.10.tgz
-
下载文件到指定目录
[[email protected] ~]# cd /usr/local/
[[email protected] 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‘进行忽略。
[[email protected] local]# wget https://www.python.org/ftp/python/2.7.10/Python-2.7.10.tgz --no-check-certificate
2. 解压文件
[[email protected] local]# tar zxvf Python-2.7.10.tgz
[[email protected] local]# ls |grep Python
Python-2.7.10
Python-2.7.10.tgz
3. 安装
[[email protected] local]# cd Python-2.7.10
[[email protected] 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
[[email protected] local]# cd Python-2.7.10
[[email protected] Python-2.7.10]# ./configure --prefix=/usr/local/python2.7.10
[[email protected] Python-2.7.10]# make && make install
4. 更新系统环境变量
[[email protected] ~]# cd /usr/local/Python-2.7.10
[[email protected] Python-2.7.10]# cd ../python2.7.10/
[[email protected] 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
[[email protected] python2.7.10]# python -V
Python 2.4.3 [目前还是2.4.3版本]
[[email protected] 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:
[[email protected] python2.7.10]# mv /usr/bin/python /usr/bin/python2.4.3
在/etc/profile文件中添加以下两行
PATH=$PATH:/usr/local/python2.7.10/bin
export PATH
[[email protected] python2.7.10]# . /etc/profile
[[email protected] python2.7.10]# python -V
Python 2.7.10
方法2:设置软连接
[[email protected] python2.7.10]# mv /usr/bin/python /usr/bin/python2.4.3
[[email protected] profile.d]# ln -s /usr/local/python2.7.10/bin/python /usr/bin/python
[[email protected] 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
[[email protected] profile.d]# python -V
Python 2.7.10
以上是关于linux系统将python升级到2.7.10版本的主要内容,如果未能解决你的问题,请参考以下文章