zoukankan      html  css  js  c++  java
  • linux下安装python3

    ------------------rhel7-----------------------

    1. 安装依赖环境

    # 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

    按个人习惯安装在某个目录,例如 /usr/python3

    创建目录

    # mkdir -p /usr/python3

    解压下载好的Python-3.x.x.tgz包

    # tar -zxvf Python-3.6.1.tgz

    4.进入解压后的目录,编译安装。

    # cd Python-3.6.1
    # ./configure --prefix=/usr/python3      这里是配置python的安装目录,对安装进行配置,并指定安装路径
    如果报错了,那就安装一下gcc
    yum -y install gcc

    make

    # make

    make install

    # make install

    这样子就完成安装了,但在终端输入python还是2.7的版本,还需要一点工作,那就是建立软连接

    # ln -s /usr/python3/bin/python3 /usr/bin/python3

    这时候,终端输入python3,就可以看到python3已经可以运行了

    配置成功后,pip3用不了,需进一步配置

    将/usr/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/python3/bin export PATH

    按ESC,输入:wq回车退出。

    修改完记得执行行下面的命令,让上一步的修改生效

    # source ~/.bash_profile

    这样就可以使用了

     更新pip版本

    python3 -m pip install --upgrade pip
  • 相关阅读:
    DoubleAnimation
    Android 图片浏览器 从原来位置放大至全屏显示
    类似qq的左滑菜单栏简单实现
    UITableView去掉section的header的粘性
    swift 闭包循环引用
    AFNetworking3.0使用
    IOS线程学习(一)
    CIImage实现滤镜效果
    UIImage学习
    可滑动的ExpandableListView
  • 原文地址:https://www.cnblogs.com/zq8421/p/10051993.html
Copyright © 2011-2022 走看看