zoukankan      html  css  js  c++  java
  • 源码包安装Python3.6

    1,安装Python3.6的依赖包
    # yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
    2.下载Python3
    # wget https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tgz
    3.安装python3
    创建目录:
    # mkdir -p /usr/local/python3
      解压下载好的Python-3.x.x.tgz包(具体包名因你下载的Python具体版本不不同?而不不同,如:我下载的是Python3.6.1.那我这里就是Python-3.6.1.tgz)
    # tar -zxvf Python-3.6.1.tgz
    4.进入解压后的目录,编译安装。
    # cd Python-3.6.1
    # ./configure --prefix=/usr/local/python3
    # make && make install
    
    5.建立python3的软链
    # ln -s /usr/local/python3/bin/python3 /usr/bin/python3
    6.并将/usr/local/python3/bin加入PATH
    # vim ~/.bash_profile
    # .bash_profile
    # Get the aliases and functions
    if [ -f ~/.bashrc ]; then
    . ~/.bashrc
    fi
    # User specific environment and startup programs
    PATH=$PATH:$HOME/bin:/usr/local/python3/bin
    export PATH
      按ESC,输入:wq回车退出。
      修改完记得执行行下面的命令,让上一步的修改生效:
    # source ~/.bash_profile
      检查Python3及pip3是否正常可用:
    # python3 -V
    Python 3.6.1
    # pip3 -V
    pip 9.0.1 from /usr/local/python3/lib/python3.6/site-packages (python 3.6)

    自动化安装脚本

    #!/bin/bash
    yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
    mkdir -p /usr/local/python3
    cd /mnt
    wget https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tgz
    tar -zxvf Python-3.6.1.tgz
    cd Python-3.6.1
    ./configure --prefix=/usr/local/python3
    make && make install
    ln -s /usr/local/python3/bin/python3 /usr/bin/python3
    echo "PATH=$PATH:/usr/local/python3/bin"  >>/etc/profile
    echo "export PATH " >>/etc/profile
    source /etc/profile
    python3 -V
  • 相关阅读:
    python_levenshtein 的安装和使用
    接口测试困难
    pycharm修改windows的IP
    Excel读取,修改,新建
    appium混合应用的处理
    冒泡排序
    选择排序
    插入排序
    python中两种退出方式os._exit(),sys.exit()
    二分查找
  • 原文地址:https://www.cnblogs.com/kaishirenshi/p/9894529.html
Copyright © 2011-2022 走看看