Python pip install requires server_hostname

后端 未结 2 1725
暗喜
暗喜 2021-02-03 11:53

I finished installing pip on linux, the pip list command works. But when using the pip install command it got the following error:

Trac         


        
相关标签:
2条回答
  • 2021-02-03 12:31

    I get the same issue, and find that it can be avoided (pip 6.0.8) in my case as follows

    pip --trusted-host pypi.python.org install <thing>
    
    0 讨论(0)
  • 2021-02-03 12:40

    pip 6.1.0 has been released, fixing this issue. You can upgrade with:

    pip --trusted-host pypi.python.org install -U pip
    

    to self-upgrade.


    Original answer:

    This is caused by a change in Python 2.7.9, which urllib3 needs to account for. See issue #543 for that project. Your OpenSSL libraries do not support SNI, which means urllib3 won't pass in the host name to the SSL socket wrapper, but Python 2.7.9 expects the hostname to be passed in anyway for different purposes.

    urllib3 is indirectly used by requests (see requests issue 2435), which in turn is being used by pip.

    I've opened a ticket to track this from pip's perspective.

    The underlying issues have been fixed by the project maintainers, and awaiting a new release. You could install the current development version of pip if you are impatient:

    pip install --trusted-host=github.com -U https://github.com/pypa/pip/archive/develop.zip
    

    This'll install pip-6.1.0.dev0, when 6.1.0 is fully released you can upgrade again with pip install -U pip to get the final release from PyPI.

    0 讨论(0)
提交回复
热议问题