Skip to main content
 首页 » 编程设计

python之无法从 get-pip.py 安装 pip

2025年02月15日12zlslch

我在没有 root 权限的情况下在远程 Linux 系统上工作。我想在本地安装 python 和 pip。我已经设法安装了 python,但在 pip 上失败了。我使用的命令如下:

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

下载成功,但运行第二条命令时,收到错误信息:

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 

我也试过

python get-pip.py 

但错误是一样的。 我的命令有什么问题? 谢谢大家帮助我!!!

请您参考如下方法:

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

解决方法是:

  1. 安装 openssl,yum install openssl openssl-devel

  2. 配置源码

  3. 然后打开Modules/Setup,取消下面部分的注释

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