我已经在自定义位置安装了python。
我正在尝试安装一些软件包,但是出现以下错误。我意识到,因为我在VM上,并且他们正在使用代理。
C:\python3.7>python -m pip install requests
Collecting requests
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x0424C6F0>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /simple/requests/
Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x0426E150>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /simple/requests/
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x0426E230>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /simple/requests/
Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x0426E310>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /simple/requests/
Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x0426E3F0>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /simple/requests/
Could not find a version that satisfies the requirement requests (from versions: )
No matching distribution found for requests
因此,我将命令更改为使用代理。它清楚地显示了证书错误,因此我联系了IT支持,他们遇到了自己的问题,这真令人沮丧。
C:\python3.7>python -m pip install requests --proxy=http://proxypac.novartis.net:2010
Collecting requests
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1056)'))': /simple/requests/
Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1056)'))': /simple/requests/
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1056)'))': /simple/requests/
Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1056)'))': /simple/requests/
Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1056)'))': /simple/requests/
Could not fetch URL https://pypi.org/simple/requests/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/requests/ (Caused by SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1056)'))) - skipping
Could not find a version that satisfies the requirement requests (from versions: )
No matching distribution found for requests
Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1056)'))) - skipping
因此,我在Internet上四处张望,试图找到绕过它的方法,然后尝试。
尝试了受信任的主机,但没有成功
C:\python3.7>python -m pip install --index-url=http://pypi.org/simple --trusted-host pypi.org --proxy=http://proxypac.novartis.net:2010 requests
Looking in indexes: http://pypi.org/simple
Collecting requests
Could not find a version that satisfies the requirement requests (from versions: )
No matching distribution found for requests
使用和不使用代理轻松安装
C:\python3.7>python -m easy_install requests
Searching for requests
Reading https://pypi.org/simple/requests/
Download error on https://pypi.org/simple/requests/: [Errno 11001] getaddrinfo failed -- Some packages may not be found!
Couldn't find index page for 'requests' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading https://pypi.org/simple/
Download error on https://pypi.org/simple/: [Errno 11001] getaddrinfo failed -- Some packages may not be found!
No local packages or working download links found for requests
error: Could not find suitable distribution for Requirement.parse('requests')
C:\python3.7>python -m easy_install requests --proxy=http://proxypac.novartis.net:2010
Searching for requests
Reading https://pypi.org/simple/requests/
Download error on https://pypi.org/simple/requests/: [Errno 11001] getaddrinfo failed -- Some packages may not be found!
Couldn't find index page for 'requests' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading https://pypi.org/simple/
Download error on https://pypi.org/simple/: [Errno 11001] getaddrinfo failed -- Some packages may not be found!
No local packages or working download links found for requests
error: Could not find suitable distribution for Requirement.parse('requests')
尝试从git获取
C:\python3.7>python -m pip install git+http://github.com/requests/requests.git
Collecting git+http://github.com/requests/requests.git
Cloning http://github.com/requests/requests.git to c:\users\gargta2\appdata\local\temp\pip-req-build-dnz33avh
fatal: unable to access 'http://github.com/requests/requests.git/': Could not resolve host: github.com
Command "git clone -q http://github.com/requests/requests.git C:\Users\gargta2\AppData\Local\Temp\pip-req-build-dnz33avh" failed with error code 128 in None
甚至无法使用wheel文件。那太荒谬了。
C:\python3.7>python -m pip install requests-2.21.0-py2.py3-none-any.whl
Processing c:\python3.7\requests-2.21.0-py2.py3-none-any.whl
Collecting idna<2.9,>=2.5 (from requests==2.21.0)
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x039C3D90>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /simple/idna/
Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x04567350>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /simple/idna/
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x04567D10>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /simple/idna/
Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x04567FD0>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /simple/idna/
Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x04545F70>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /simple/idna/
Could not find a version that satisfies the requirement idna<2.9,>=2.5 (from requests==2.21.0) (from versions: )
No matching distribution found for idna<2.9,>=2.5 (from requests==2.21.0)
如@hoefling在注释中建议的,尝试其他命令,但失败:(
C:\python3.7>python -m pip install requests -vvv --index-url=https://pypi.org/simple --trusted-host=pypi.org --trusted-host=files.pythonhosted.org --proxy=http://proxypac.novartis.net:2010?
Config variable 'Py_DEBUG' is unset, Python ABI tag may be incorrect
Config variable 'WITH_PYMALLOC' is unset, Python ABI tag may be incorrect
Created temporary directory: C:\Users\gargta2\AppData\Local\Temp\pip-ephem-wheel-cache-3r4pn3eq
Created temporary directory: C:\Users\gargta2\AppData\Local\Temp\pip-req-tracker-h3p1whde
Created requirements tracker 'C:\\Users\\gargta2\\AppData\\Local\\Temp\\pip-req-tracker-h3p1whde'
Created temporary directory: C:\Users\gargta2\AppData\Local\Temp\pip-install-k9yyg7yl
Collecting requests
1 location(s) to search for versions of requests:
* https://pypi.org/simple/requests/
Getting page https://pypi.org/simple/requests/
Starting new HTTPS connection (1): pypi.org:443
Incremented Retry for (url='/simple/requests/'): Retry(total=4, connect=None, read=None, redirect=None, status=None)
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1056)'))': /simple/requests/
Starting new HTTPS connection (2): pypi.org:443
Incremented Retry for (url='/simple/requests/'): Retry(total=3, connect=None, read=None, redirect=None, status=None)
Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1056)'))': /simple/requests/
Starting new HTTPS connection (3): pypi.org:443
Incremented Retry for (url='/simple/requests/'): Retry(total=2, connect=None, read=None, redirect=None, status=None)
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1056)'))': /simple/requests/
Starting new HTTPS connection (4): pypi.org:443
Incremented Retry for (url='/simple/requests/'): Retry(total=1, connect=None, read=None, redirect=None, status=None)
Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1056)'))': /simple/requests/
Starting new HTTPS connection (5): pypi.org:443
Incremented Retry for (url='/simple/requests/'): Retry(total=0, connect=None, read=None, redirect=None, status=None)
Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1056)'))': /simple/requests/
Starting new HTTPS connection (6): pypi.org:443
Could not fetch URL https://pypi.org/simple/requests/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/requests/ (Caused by SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1056)'))) - skipping
Could not find a version that satisfies the requirement requests (from versions: )
Cleaning up...
Removed build tracker 'C:\\Users\\gargta2\\AppData\\Local\\Temp\\pip-req-tracker-h3p1whde'
No matching distribution found for requests
Exception information:
Traceback (most recent call last):
File "C:\python3.7\lib\site-packages\pip\_internal\cli\base_command.py", line 143, in main
status = self.run(options, args)
File "C:\python3.7\lib\site-packages\pip\_internal\commands\install.py", line 318, in run
resolver.resolve(requirement_set)
File "C:\python3.7\lib\site-packages\pip\_internal\resolve.py", line 102, in resolve
self._resolve_one(requirement_set, req)
File "C:\python3.7\lib\site-packages\pip\_internal\resolve.py", line 256, in _resolve_one
abstract_dist = self._get_abstract_dist_for(req_to_install)
File "C:\python3.7\lib\site-packages\pip\_internal\resolve.py", line 209, in _get_abstract_dist_for
self.require_hashes
File "C:\python3.7\lib\site-packages\pip\_internal\operations\prepare.py", line 218, in prepare_linked_requirement
req.populate_link(finder, upgrade_allowed, require_hashes)
File "C:\python3.7\lib\site-packages\pip\_internal\req\req_install.py", line 164, in populate_link
self.link = finder.find_requirement(self, upgrade)
File "C:\python3.7\lib\site-packages\pip\_internal\index.py", line 621, in find_requirement
'No matching distribution found for %s' % req
pip._internal.exceptions.DistributionNotFound: No matching distribution found for requests
Config variable 'Py_DEBUG' is unset, Python ABI tag may be incorrect
Config variable 'WITH_PYMALLOC' is unset, Python ABI tag may be incorrect
1 location(s) to search for versions of pip:
* https://pypi.org/simple/pip/
Getting page https://pypi.org/simple/pip/
Starting new HTTPS connection (1): pypi.org:443
Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1056)'))) - skipping
还尝试了其他方法 1.用https更改http 2.我看不到任何pip.ini文件 但似乎没有任何作用。
答案 0 :(得分:0)
由于您的网络防火墙阻止了您的访问,因此您将需要隧穿pip请求,此链接可以帮助Connect to VPN by Powershell,此后您应该能够隧穿Pip请求,因此有多个VPN提供商可以您可以使用允许直通连接的方式,我的建议是NordVPN和DotVPN。
如果您对通过VPN建立连接有其他疑问,可以在https://docs.microsoft.com/en-us/powershell/module/vpnclient/add-vpnconnection?view=win10-ps处查看。
此外,如果您的网络防火墙阻止了对PyPi的访问,则它们最有可能阻止对VPN的访问,因此,我建议测试一下您尝试通过的VPN是否未被IP阻止。卷毛还有一种替代方法,称为bitsadmin,可用于验证您是否有权访问vpn,或仅使用老式的ping。
P.S。这两个VPN都有免费层,这就是我的建议。
如果仍然无法正常工作,请对该错误进行注释。