关于python:无法从get-pip.py安装pip

Cannot install pip from get-pip.py

我正在未经root许可的远程Linux系统上工作。 我想在本地安装python和pip。 我已经成功安装了python,但是在pip上失败了。 我使用的命令如下:

1
2
wget https://bootstrap.pypa.io/get-pip.py
python get-pip.py --user

下载成功,但是在运行第二条命令时,我收到了错误消息:

1
2
3
4
5
6
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Collecting pip
Could not fetch URL https://pypi.python.org/simple/pip/:
There was a problem confirming the ssl certificate: Can't connect to HTTPS URL because the SSL module is not available. - skipping
Could not find a version that satisfies the requirement pip (from versions: )
No matching distribution found for pip

我也试过

1
python get-pip.py

但是错误是相同的。
我的命令出了什么问题?
谢谢大家的帮助!!!

  • 您如何安装python? 错误是说python未使用ssl支持进行编译:stackoverflow.com/questions/27952343/也许尝试:apt-get install python-pipyum install python-pip也:stackoverflow.com/questions/5937337/或使用发行版软件包管理器yum或其他名称。
  • 我通过wget python.org/ftp/python/2.7.11/Python-2.7.11.tgz安装python
  • 然后解压缩,安装,导出PATH等。


在这种情况下,您会发现也不能import ssl

解决方案是:

  • 安装openssl yum install openssl openssl-devel

  • 配置源代码

  • 然后打开Modules/Setup,然后取消注释以下部分

    1
    2
    3
    4
    #SSL=/usr/local/ssl
    #_ssl _ssl.c \
    #       -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
    #       -L$(SSL)/lib -lssl -lcrypto
  • make & make install python来自源代码