zoukankan      html  css  js  c++  java
  • 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升级完成

  • 相关阅读:
    安装OpenCV:OpenCV 3.0、OpenCV 2.4.8、OpenCV 2.4.9 +VS 开发环境配置
    各种编程语言的深度学习库整理
    十个开源深度学习框架
    深度学习框架的评估与比较
    Caffe 深度学习框架上手教程
    机器视觉开源代码集合
    人工智能的妙用:谷歌公布图像字幕技术
    谷歌推出最新图像识别工具Google Cloud Vision API
    机器学习常见算法分类汇总
    神经网络的分类及其应用
  • 原文地址:https://www.cnblogs.com/TTyb/p/5864479.html
Copyright © 2011-2022 走看看