zoukankan      html  css  js  c++  java
  • centos6.9安装python3.6.9独立的virtualenv环境,并且能正确引入ssl

    centos6.9安装python3.6.9独立的virtualenv环境,并且能正确引入ssl

    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
    # 获取编译安装python3.6.6
    mkdir -p /usr/local/python36
    wget https://www.python.org/ftp/python/3.6.9/Python-3.6.9.tgz
    tar xf Python-3.6.9.tgz
    cd Python-3.6.9

    # 修改如下205,209~212 共5行,去掉前面的# 号注释
    vim Modules/Setup.dist

    205 _socket socketmodule.c
    206
    207 # Socket module helper for SSL support; you must comment out the other
    208 # socket line above, and possibly edit the SSL variable:
    209 SSL=/usr/local/ssl
    210 _ssl _ssl.c
    211         -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl
    212         -L$(SSL)/lib -lssl -lcrypto


    ./configure --prefix=/usr/local/python36
    make && make install

    # 验证ssl是否能够正常引入
    # /usr/local/python36/bin/python3
    Python 3.6.9 (default, Dec 19 2019, 00:56:46)
    [GCC 4.4.7 20120313 (Red Hat 4.4.7-18)] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import ssl


    ln -s /usr/local/python36/bin/python3 /usr/bin/python3
    ln -s /usr/local/python36/bin/pip3 /usr/bin/pip3

    2.安装virtualenv虚拟环境
    pip3 install virtualenv
    # 创建存放虚拟环境的目录
    mkdir -p /usr/local/monitor_api_venv

    # 创建纯净的虚拟环境
    # /usr/local/python36/bin/virtualenv --no-site-packages --python=/usr/local/python36/bin/python3.6 /usr/local/monitor_api_venv

  • 相关阅读:
    Nhibernate1
    控制反转(IoC)
    Windbg是windows平台上强大的调试器
    Java 7 语法新特性
    区间数据计算
    红黑树数据结构剖析
    .net下灰度模式图像
    如何配置Hyper-V的虚拟机通过主机网络上网 (NAT)
    产品落地
    poj-3898 Software Industry Revolution DP
  • 原文地址:https://www.cnblogs.com/reblue520/p/12068816.html
Copyright © 2011-2022 走看看