zoukankan      html  css  js  c++  java
  • 如何在已经存在python2的linux环境上安装python3

    最近看到好多人都在问在已经存在python2.7的环境下如何安装python3,于是我决定写下这篇文档,供大家学习参考,希望能够给大家带来帮助

    有的人在安装的时候可能会先将python2卸载掉,这个地方严重强调一下,不要去卸载系统中已经存在的python2,否则会造成系统中好多其他需要python执行的程序异常

    • 系统环境
    [root@localhost install]# pwd
    /data/install
    
    [root@localhost install]# cat /etc/redhat-release 
    CentOS release 6.3 (Final)
    
    [root@localhost install]# uname -a
    Linux localhost 2.6.32-358.6.2.el6.x86_64 #1 SMP Thu May 16 20:59:36 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
    
    • python3.4的安装方法
    [root@localhost install]# wget https://www.python.org/ftp/python/3.4.4/Python-3.4.4.tgz
    [root@localhost install]# tar -zxf Python-3.4.4.tgz
    [root@localhost install]# cd Python-3.4.4
    
    # 在安装包中有一个README的文件,里面有写如何安装
    [root@localhost Python-3.4.4]# ls
    aclocal.m4    config.sub  configure.ac  Grammar  install-sh  LICENSE  Makefile.pre.in  Modules  Parser  PCbuild        Python  setup.py
    config.guess  configure   Doc           Include  Lib         Mac      Misc             Objects  PC      pyconfig.h.in  README  Tools
    
    [root@localhost Python-3.4.4]# ./configure
    [root@localhost Python-3.4.4]# make
    [root@localhost Python-3.4.4]# make install
    
    • 测试
    [root@localhost Python-3.4.4]# python3
    Python 3.4.4 (default, Jun 27 2016, 07:47:54) 
    [GCC 4.4.7 20120313 (Red Hat 4.4.7-16)] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> 
    

    以后执行python程序就可以使用python3 程序名 去执行了

  • 相关阅读:
    解决在IDEA里,autoconfig在跑JUnit测试时,不能输入的问题 #48
    Java 工程批量编码转换,从GBK到UTF-8
    基于springboot 使用定时调度任务
    ant design vue notification
    获取枚举
    .NET Core5+Mysql+Jexus部署到Centos7
    Nginx_配置
    Vue_项目优化使用Gzip暴力压缩
    VUE通过Docker传入参数替换环境变量
    5. SpringBoot框架华夏ERP源码审计
  • 原文地址:https://www.cnblogs.com/CongZhang/p/5619093.html
Copyright © 2011-2022 走看看