Pip SSL Error on Windows

前端 未结 6 881
萌比男神i
萌比男神i 2020-12-15 14:02

I use Python 3.x on Windows 7 64 bit in an environment without full control of inbound/outbound traffic processing. Up till this week I\'ve been able to use the --trus

相关标签:
6条回答
  • 2020-12-15 14:26

    Best solution i felt is:- Access the file relevant to SSL. Find the folder in the install location, where sessions.py is located. (I guess it is in folder ~~~₩pip₩vender₩requests)

    Open sessions.py and modify self.verify = True to self.verify = False

    Install using trusted host code as below

    0 讨论(0)
  • 2020-12-15 14:28

    What ended up working for me is to add all the domains that are part of the new pypi routing.

    pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org <package>
    

    Which can also be setup in a pip.ini file.

    0 讨论(0)
  • 2020-12-15 14:35

    I had the same proplem and I solved it during the installation of tensorflow. Here is the solution in steps:

    1. Access the file relevant to SSL. Find the folder in the install location, where sessions.py is located. (I guess it is in folder ~~~₩pip₩vender₩requests)

    2. Open sessions.py and modify self.verify = True to self.verify = False

    3. Install using trusted host code as below

      pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org <package name> 
      
    0 讨论(0)
  • 2020-12-15 14:47

    The following solution worked for me :

    1. Go to run. Type %appdata%
    2. Go to the folder pip and edit the pip.ini file.
    3. If the folder doesn't exist create one and also create a pip.ini file and edit in a text editor.
    4. Add the following :
    [global]
    trusted-host = pypi.python.org
                   pypi.org
                   files.pythonhosted.org
                   raw.githubusercontent.com
                   github.com
    
    0 讨论(0)
  • 2020-12-15 14:52

    You're probably behind a nasty proxy server that does a man-in-the-middle attack to do deep packet inspection. You need to obtain the CA certificate file from your proxy admin in order to tell Python that everything is OK. You could also extract this from your web browser or anything else that is configured to work with the proxy.

    When you have obtained the certificate, you can either add it to the cacert.pem file of the certifi package, or tell pip about it directly with the --cert option, or global.cert in the pip.conf file.

    0 讨论(0)
  • 2020-12-15 14:53

    pip install cryptography was throwing error:

    Could not install packages due to an EnvironmentError: HTTPSConnectionPool(host='files.pythonhosted.org'

    Could not fetch URL https://pypi.org/simple/cryptography/: There was a problem confirming the ssl certificate:

    Tried adding these URLs as trusted host and it worked:

    pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org cryptography
    
    0 讨论(0)
提交回复
热议问题