Pip 安装失败:需要 SSL

2022-01-15 00:00:00 python pip dependencies rsa

问题描述

Collecting rsa==3.1.1 (from -r /racetrack/.requirements.txt (line 41))
eval (python -m virtualfish)
  Downloading rsa-3.1.1.tar.gz
    Complete output from command python setup.py egg_info:
    Downloading http://pypi.python.org/packages/source/d/distribute/distribute-0.6.10.tar.gz
    Traceback (most recent call last):          
      File "/usr/lib/python2.7/urllib2.py", line 558, in http_error_default
        raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
    urllib2.HTTPError: HTTP Error 403: SSL is required


解决方案

解决方案:升级到最新版本的库.

一切从这里开始,突然(2017 年 10 月)Distutils 团队决定撤销对非 https 请求的支持,而不用担心破坏许多 python 库早期版本的向后兼容性.有点不专业,但嘿,这是 Python 世界.

It all starts here, suddenly(on Oct-2017) the Distutils team decided to revoke support for non-https requests without worrying about breaking the backward compatibility of earlier versions of numerous python libraries. Bit unprofessional, but hey it's Python world.

所以这里是修复,只需在任何库(nltk==3.2.5 等)

So here is the fix, Simply move on to the latest version of the library (rsa==3.4.2 in my case) on whatever library (nltk==3.2.5 etc)

替代解决方案:分叉(或本地复制)repo 的版本 &修改http url为https

Alternate Solution: Fork(or locally copy) the version of repo & modify the http url into https

尽管如此,请注意您是否在维护另一个项目的同时这样做,因为您正在升级的依赖项可能与作者想要的原始库不兼容,例如在我的上下文中使用了 rsa在另一个库下作为依赖项.因此解决方案是升级父库,以便自动处理此问题.

Nonetheless, watch out if you are doing this while maintaining another project since the dependency you are upgrading might not be compatible with the original library the author had intended, for example in my context rsa was used under another library as a dependency. Thus the solution was to upgrade the parent library so that this issue is automatically taken care.

相关文章