问题
I want to install some modules in a Enterprise VM in order to create some Python Scripts. I'm trying to use PIP with Proxy to do it. I'm using this command lines:
C:\Users\user>SET HTTPS_PROXY=https://user:pass@199.00.11.11:8080
C:\Users\user>SET PROXY=http://user:pass@199.00.11.11:8080
C:\Users\user>pip install datetime
To have access to my virtual machine I've this credentials:
- USER: NAN/user
- PASS: pass
But I am getting this error:
Collecting datetime
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 407 Proxy Authentication Required ( Forefront TMG requires authorization to fulfill the request. Access to the Web Proxy filter is denied. )',))': /simple/datetime/
Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 407 Proxy Authentication Required ( Forefront TMG requires authorization to fulfill the request. Access to the Web Proxy filter is denied. )',))': /simple/datetime/
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 407 Proxy Authentication Required ( Forefront TMG requires authorization to fulfill the request. Access to the Web Proxy filter is denied. )',))': /simple/datetime/
Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 407 Proxy Authentication Required ( Forefront TMG requires authorization to fulfill the request. Access to the Web Proxy filter is denied. )',))': /simple/datetime/
Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 407 Proxy Authentication Required ( Forefront TMG requires authorization to fulfill the request. Access to the Web Proxy filter is denied. )',))': /simple/datetime/
Could not find a version that satisfies the requirement datetime (from versions: )
No matching distribution found for datetime
What I need to do in order to get the python module?
回答1:
Try like this:
set HTTP_PROXY=http://199.00.11.11:8080
set HTTPS_PROXY=https://199.00.11.11:8080
回答2:
First, install a proxy authentication service like CNTLM)
Second,
set http_proxy=http://username:password@proxyAddress:port
set https_proxy=https://username:password@proxyAddress:port
回答3:
I also faced this issue even with proxy, adding "--isolated" helped
For eg: pip install datetime --isolated
Note: My proxy is already set in "pip config"
回答4:
I recently had a similar issue doing pip3 install awscli
on my local mac. I checked my env and there were no proxies set there. The solution that worked for me was disabling proxies from the network which got set on my machine for some reason. To do that
- Click on Wifi
- Open Network Preferences
- Click Advanced button
- Go to proxies tab
- Uncheck Web Proxy and Secure Web Proxy
Again, I know that network proxy misconfiguration is rare and this answer may not be the most suitable answer. But this might come in useful for some folks as this is right now the first link that comes on google search for pip install ProxyError.
来源:https://stackoverflow.com/questions/49979354/python-pip-install-proxy-error-cannot-connect-to-proxy-oserror