【问题标题】:Can't connect to HTTPS URL because the SSL module is not available on Mac/OS无法连接到 HTTPS URL,因为 SSL 模块在 Mac/OS 上不可用
【发布时间】:2020-03-28 02:21:54
【问题描述】:

尝试构建 Python 2.7.17,然后在 Mac OS 10.14 上安装 pip

使用 brew 安装 OpenSSL

Python 的构建无法构建 _ssl。当我尝试构建 pip 时,它失败并出现错误“无法连接到 HTTPS URL,因为 SSL 模块不可用

OpenSSL 已正确安装在 /usr/local/Cellar/openssl@1.1/1.1.1d/

【问题讨论】:

    标签: python pip openssl homebrew


    【解决方案1】:

    Python 在 /usr/local/ssl 中查找 ssl

    为了构建它,我执行了以下操作: 1.设置不涉及任何奇怪字符的OpenSSL路径:

    cd /usr/local/Cellar/
    ln -s openssl\@1.1 openssl
    

    2: 运行 ./configure

    3:编辑的 Makefile 将所有“/usr/local/ssl”替换为“/usr/local/Cellar/openssl”

    4:运行 make / make test / make install

    这创建了一个具有 _ssl 的 Python,因此 pip 将运行

    【讨论】:

    • 您不必编辑 Makefile,请参阅 superuser.com/a/1346305/456335。由于您是在 Mac 上构建的,因此您可能需要调整 DYLD_LIBRARY_PATH 而不是 LD_LIBRARY_PATH,但其余部分应该几乎相同。
    猜你喜欢
    • 2019-08-26
    • 1970-01-01
    • 1970-01-01
    • 2019-03-05
    • 1970-01-01
    • 2020-08-01
    • 1970-01-01
    • 2022-11-10
    • 2019-06-05
    相关资源
    最近更新 更多