• Linux下升级python


    本文的Linux系统为CentOS 7 64

    在Linux系统的下载文件夹中邮件打开终端,输入命令:

    wget http://www.python.org/ftp/python/3.4.4/Python-3.4.4.tgz

    这样子python文件的安装包就会下载到下载这个文件夹里面了:

    解压命令:

    tar -xzvf Python-3.4.4.tgz
    

     解压完成,切换到该文件夹下,也就是cd

    将安装设定在我们前面建立的python3的文件夹下面:

     ./configure --prefix=/home/ttyb/python3
    

    但是发现:

    checking build system type... x86_64-unknown-linux-gnu
    checking host system type... x86_64-unknown-linux-gnu
    checking for --enable-universalsdk... no
    checking for --with-universal-archs... no
    checking MACHDEP... linux
    checking for --without-gcc... no
    checking for gcc... no
    checking for cc... no
    checking for cl.exe... no
    configure: error: in `/home/ttyb/下载/Python-3.4.4':
    configure: error: no acceptable C compiler found in $PATH
    See `config.log' for more details
    

    原来是没有gcc,我这里是新安装的Linux,所以我需要安装gcc,安装命令如下:

    yum install gcc
    

    但是!

    [ttyb@localhost Python-3.4.4]$ yum install gcc
    已加载插件:fastestmirror, langpacks
    您需要 root 权限执行此命令。
    

    我是子账号来玩的,所以要用root账户,切换:

    su root
    

    然后要输入密码,就输入密码。成功切换:

    [ttyb@localhost Python-3.4.4]$ su root
    密码:
    [root@localhost Python-3.4.4]# yum install gcc
    

    安装了一大堆,中间会让你来几个y/n,全部y就行。

    安装完毕后再次运行:

    [root@localhost Python-3.4.4]# su ttyb
    [ttyb@localhost Python-3.4.4]$  ./configure --prefix=/home/ttyb/python3
    

    这时候就可以安装了,我的是python3.4.4

    等他设置好安装位置后,继续安装:

    make && make install
    

    安装完毕了过后,将python2.7.5改成python3.4.4,配置环境:

    mv /usr/bin/python /usr/bin/python2.7.5
    

    然后随便在桌面打开终端输入:

    [root@localhost Python-3.4.4]# python
    -bash: /usr/bin/python: 没有那个文件或目录
    

    可以发现python没有了,再配置python3.4.4:

    ln -s /home/ttyb/python3/bin/python3 /usr/bin/python
    

    再在桌面检查python的版本:

    [ttyb@localhost 桌面]$ python
    Python 3.4.4 (default, Sep 12 2016, 14:13:28) 
    [GCC 4.8.5 20150623 (Red Hat 4.8.5-4)] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    

    变成了python3.4.4,ok,python升级完成

  • 相关阅读:
    linux下使用 du查看某个文件或目录占用磁盘空间的大小
    Mac 使用bootcamp安装windows 运行Hyper-v时的硬件虚拟化没有启动的问题
    DockerToolbox安装docker
    如何在Ubuntu中安装Docker和运行 Docker容器
    react native开发过程遇到的各种问题汇总
    程序员接私活怎样防止做完了不给钱?
    Creat React App deploy on GitHub
    git 提交报错 cannot do a partial commit during a merge
    排序合并连接(sort merge join)的原理
    开源 免费 java CMS
  • 原文地址:https://www.cnblogs.com/TTyb/p/5864479.html
Copyright © 2020-2023  润新知