【问题标题】:HTTPSHandler error while installing pip with python 2.7.9使用 python 2.7.9 安装 pip 时出现 HTTPSHandler 错误
【发布时间】:2015-11-10 08:06:06
【问题描述】:

您好,我正在尝试使用 python 2.7.9 安装 pip,但不断出现以下错误。我想创建 python 虚拟环境。

 python get-pip.py

        Traceback (most recent call last):
          File "get-pip.py", line 17767, in <module>
            main()
          File "get-pip.py", line 162, in main
            bootstrap(tmpdir=tmpdir)
          File "get-pip.py", line 82, in bootstrap
            import pip
          File "/tmp/tmp_Tfw2V/pip.zip/pip/__init__.py", line 15, in <module>
          File "/tmp/tmp_Tfw2V/pip.zip/pip/vcs/subversion.py", line 9, in <module>
          File "/tmp/tmp_Tfw2V/pip.zip/pip/index.py", line 30, in <module>
          File "/tmp/tmp_Tfw2V/pip.zip/pip/wheel.py", line 35, in <module>
          File "/tmp/tmp_Tfw2V/pip.zip/pip/_vendor/distlib/scripts.py", line 14, in <module>
          File "/tmp/tmp_Tfw2V/pip.zip/pip/_vendor/distlib/compat.py", line 31, in <module>

   ImportError: cannot import name HTTPSHandler

我猜这与 openssl 库有关。由于我没有 sudo 访问权限,因此我想从源代码将其安装在主文件夹中。知道怎么做吗?

【问题讨论】:

    标签: python installation openssl pip virtualenv


    【解决方案1】:

    确保在构建 Python 2.7 之前安装了 openssl 和 openssl-devel

     yum install openssl openssl-devel
    

    apt-get install openssl openssl-devel
    

    或(对于 Debian):

    apt-get install libssl-dev
    

    重建 Python

    cd ~
    wget https://www.python.org/ftp/python/2.7.9/Python-2.7.9.tgz
    tar xzf Python-2.7.9.tgz
    cd Python-2.7.9
    ./configure
    make install
    

    那么python get-pip.py 应该可以工作了。

    【讨论】:

      【解决方案2】:

      安装 openssl098e 为我解决了这个问题。

      【讨论】:

        猜你喜欢
        • 2017-04-20
        • 2018-09-26
        • 1970-01-01
        • 2018-03-13
        • 1970-01-01
        • 1970-01-01
        • 2021-01-18
        • 2023-03-30
        • 2020-06-08
        相关资源
        最近更新 更多