温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

linux 安装 python3

发布时间:2020-07-21 10:41:04 来源:网络 阅读:132 作者:符十三郎 栏目:编程语言

linux 安装 python3

软件源

  1. 下载软件
    mkdir -p /soft 
    cd /soft 
    wget https://www.python.org/ftp/python/3.6.6/Python-3.6.6.tgz
    yum install sqlite-devel
  2. 安装
    tar xf Python-3.6.6.tgz
    cd Python-3.6.6
    mkdir -p /usr/local/python3
    ./configure --prefix=/usr/local/python3
    make && make install
  3. 配置环境变量

    ln -s /usr/local/python3/bin/python3 /usr/bin/python3
    vim ~/.bash_profile
    PATH=$PATH:$HOME/bin:/usr/local/python3/bin
    source ~/.bash_profile
  4. ssl相关

python在使用时,可能会使用ssl模块。所以在编译时,可以直接将ssl模块编译进去。

yum install openssl
yum install openssl-devel -y
cd Python-3.6.6
vi Modules/Setup #修改文件如下

    # Socket module helper for socket(2)
    _socket socketmodule.c

    # Socket module helper for SSL support; you must comment out the other
    # socket line above, and possibly edit the SSL variable:
    SSL=/usr/local/ssl
    _ssl _ssl.c \
        -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
        -L$(SSL)/lib -lssl -lcrypto

然后进行编译安装即可
向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI