我是原生Linux用户和开发人员,但由于我现在在工作中使用Windows 10,因此我在个人计算机上执行通常最基本的任务时遇到了一些麻烦。我已经从现有代码创建了一个python项目,但需要为它安装所需的模块。我尝试按照MSDN说明访问工具 - > Python工具 - > Python环境。
这个过程似乎有点自我解释,但是当我尝试升级pip时,我收到了这个错误
Cannot fetch index base URL https://pypi.python.org/simple/
我在尝试点击安装NumPy时收到同样的错误
我目前真正需要的模块虽然来自github存储库而不是PyPi。通常我会像这样安装它
pip install https://github/u/r/l/file.zip
但这会返回不同的错误。完整输出在我的点差错误日志中就像这样
C:\Python34\lib\site-packages\pip\__main__.py run on 04/12/18 15:00:30
Downloading/unpacking https://github.com/s4w3d0ff/python-poloniex/archive/v0.4.7.zip
Cleaning up...
Exception:
Traceback (most recent call last):
File "C:\Python34\lib\site-packages\pip\_vendor\requests\packages\urllib3\connectionpool.py", line 493, in urlopen
body=body, headers=headers)
File "C:\Python34\lib\site-packages\pip\_vendor\requests\packages\urllib3\connectionpool.py", line 291, in _make_request
conn.request(method, url, **httplib_request_kw)
File "C:\Python34\lib\http\client.py", line 1090, in request
self._send_request(method, url, body, headers)
File "C:\Python34\lib\http\client.py", line 1128, in _send_request
self.endheaders(body)
File "C:\Python34\lib\http\client.py", line 1086, in endheaders
self._send_output(message_body)
File "C:\Python34\lib\http\client.py", line 924, in _send_output
self.send(msg)
File "C:\Python34\lib\http\client.py", line 859, in send
self.connect()
File "C:\Python34\lib\site-packages\pip\_vendor\requests\packages\urllib3\connection.py", line 159, in connect
**self.conn_kw)
File "C:\Python34\lib\socket.py", line 491, in create_connection
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
File "C:\Python34\lib\socket.py", line 530, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 11002] getaddrinfo failed
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Python34\lib\site-packages\pip\_vendor\requests\adapters.py", line 327, in send
timeout=timeout
File "C:\Python34\lib\site-packages\pip\_vendor\requests\packages\urllib3\connectionpool.py", line 543, in urlopen
raise MaxRetryError(self, url, e)
pip._vendor.requests.packages.urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='github.com', port=443): Max retries exceeded with url: /s4w3d0ff/python-poloniex/archive/v0.4.7.zip (Caused by <class 'socket.gaierror'>: [Errno 11002] getaddrinfo failed)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Python34\lib\site-packages\pip\basecommand.py", line 122, in main
status = self.run(options, args)
File "C:\Python34\lib\site-packages\pip\commands\install.py", line 278, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "C:\Python34\lib\site-packages\pip\req.py", line 1197, in prepare_files
do_download,
File "C:\Python34\lib\site-packages\pip\req.py", line 1375, in unpack_url
self.session,
File "C:\Python34\lib\site-packages\pip\download.py", line 546, in unpack_http_url
resp = session.get(target_url, stream=True)
File "C:\Python34\lib\site-packages\pip\_vendor\requests\sessions.py", line 468, in get
return self.request('GET', url, **kwargs)
File "C:\Python34\lib\site-packages\pip\download.py", line 237, in request
return super(PipSession, self).request(method, url, *args, **kwargs)
File "C:\Python34\lib\site-packages\pip\_vendor\requests\sessions.py", line 456, in request
resp = self.send(prep, **send_kwargs)
File "C:\Python34\lib\site-packages\pip\_vendor\requests\sessions.py", line 559, in send
r = adapter.send(request, **kwargs)
File "C:\Python34\lib\site-packages\pip\_vendor\requests\adapters.py", line 375, in send
raise ConnectionError(e, request=request)
pip._vendor.requests.exceptions.ConnectionError: HTTPSConnectionPool(host='github.com', port=443): Max retries exceeded with url: /s4w3d0ff/python-poloniex/archive/v0.4.7.zip (Caused by <class 'socket.gaierror'>: [Errno 11002] getaddrinfo failed)
有谁知道问题可能是什么?
Windows的10 发生在Visual Studio 2015和2017中 python 3.4和3.6 pip 1.5.6和pip 9.0.1
答案 0 :(得分:0)
由于错误提及,最大重试错误,这意味着可能存在连接问题。确保您的网络管理员允许您下载软件包
答案 1 :(得分:0)
初始异常显示为getaddrinfo failed
,表示DNS解析失败。
我会运行nslookup github.com
并查看它是否已解决。