代码之家  ›  专栏  ›  技术社区  ›  mrks_

Pip错误,OSError Errno 22无效参数

  •  3
  • mrks_  · 技术社区  · 8 年前

    在使用pip搜索或安装软件包时,我发现以下错误:

    pip3 search validate
    Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'ProtocolError('Connection aborted.', OSError(22, 'Invalid argument'))': /pypi
    Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after connection broken by 'ProtocolError('Connection aborted.', OSError(22, 'Invalid argument'))': /pypi
    Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by 'ProtocolError('Connection aborted.', OSError(22, 'Invalid argument'))': /pypi
    Retrying (Retry(total=1, connect=None, read=None, redirect=None)) after connection broken by 'ProtocolError('Connection aborted.', OSError(22, 'Invalid argument'))': /pypi
    Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connection broken by 'ProtocolError('Connection aborted.', OSError(22, 'Invalid argument'))': /pypi
    Exception:
    Traceback (most recent call last):
      File "/usr/local/lib/python3.6/site-packages/pip/_vendor/requests/packages/urllib3/connectionpool.py", line 595, in urlopen
        chunked=chunked)
      File "/usr/local/lib/python3.6/site-packages/pip/_vendor/requests/packages/urllib3/connectionpool.py", line 352, in _make_request
        self._validate_conn(conn)
      File "/usr/local/lib/python3.6/site-packages/pip/_vendor/requests/packages/urllib3/connectionpool.py", line 831, in _validate_conn
        conn.connect()
      File "/usr/local/lib/python3.6/site-packages/pip/_vendor/requests/packages/urllib3/connection.py", line 289, in connect
        ssl_version=resolved_ssl_version)
      File "/usr/local/lib/python3.6/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py", line 308, in ssl_wrap_socket
        return context.wrap_socket(sock, server_hostname=server_hostname)
      File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 407, in wrap_socket
        _context=self, _session=session)
      File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 791, in __init__
        self.getpeername()
    OSError: [Errno 22] Invalid argument
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/usr/local/lib/python3.6/site-packages/pip/_vendor/requests/adapters.py", line 423, in send
        timeout=timeout
      File "/usr/local/lib/python3.6/site-packages/pip/_vendor/requests/packages/urllib3/connectionpool.py", line 668, in urlopen
        release_conn=release_conn, **response_kw)
      File "/usr/local/lib/python3.6/site-packages/pip/_vendor/requests/packages/urllib3/connectionpool.py", line 668, in urlopen
        release_conn=release_conn, **response_kw)
      File "/usr/local/lib/python3.6/site-packages/pip/_vendor/requests/packages/urllib3/connectionpool.py", line 668, in urlopen
        release_conn=release_conn, **response_kw)
      [Previous line repeated 1 more times]
      File "/usr/local/lib/python3.6/site-packages/pip/_vendor/requests/packages/urllib3/connectionpool.py", line 640, in urlopen
        _stacktrace=sys.exc_info()[2])
      File "/usr/local/lib/python3.6/site-packages/pip/_vendor/requests/packages/urllib3/util/retry.py", line 287, in increment
        raise MaxRetryError(_pool, url, error or ResponseError(cause))
    pip._vendor.requests.packages.urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='pypi.python.org', port=443): Max retries exceeded with url: /pypi (Caused by ProtocolError('Connection aborted.', OSError(22, 'Invalid argument')))
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/usr/local/lib/python3.6/site-packages/pip/basecommand.py", line 215, in main
        status = self.run(options, args)
      File "/usr/local/lib/python3.6/site-packages/pip/commands/search.py", line 45, in run
        pypi_hits = self.search(query, options)
      File "/usr/local/lib/python3.6/site-packages/pip/commands/search.py", line 62, in search
        hits = pypi.search({'name': query, 'summary': query}, 'or')
      File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/xmlrpc/client.py", line 1112, in __call__
        return self.__send(self.__name, args)
      File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/xmlrpc/client.py", line 1452, in __request
        verbose=self.__verbose
      File "/usr/local/lib/python3.6/site-packages/pip/download.py", line 775, in request
        headers=headers, stream=True)
      File "/usr/local/lib/python3.6/site-packages/pip/_vendor/requests/sessions.py", line 522, in post
        return self.request('POST', url, data=data, json=json, **kwargs)
      File "/usr/local/lib/python3.6/site-packages/pip/download.py", line 386, in request
        return super(PipSession, self).request(method, url, *args, **kwargs)
      File "/usr/local/lib/python3.6/site-packages/pip/_vendor/requests/sessions.py", line 475, in request
        resp = self.send(prep, **send_kwargs)
      File "/usr/local/lib/python3.6/site-packages/pip/_vendor/requests/sessions.py", line 596, in send
        r = adapter.send(request, **kwargs)
      File "/usr/local/lib/python3.6/site-packages/pip/_vendor/cachecontrol/adapter.py", line 47, in send
        resp = super(CacheControlAdapter, self).send(request, **kw)
      File "/usr/local/lib/python3.6/site-packages/pip/_vendor/requests/adapters.py", line 487, in send
        raise ConnectionError(e, request=request)
    pip._vendor.requests.exceptions.ConnectionError: HTTPSConnectionPool(host='pypi.python.org', port=443): Max retries exceeded with url: /pypi (Caused by ProtocolError('Connection aborted.', OSError(22, 'Invalid argument')))
    

    Pip版本:Pip 9.0.1,来自/usr/local/lib/python3.6/site-packages(python 3.6)
    Python版本:3.6.3
    操作系统:macOS High Sierra 10.13

    我尝试重新安装python和pip。我不相信我在使用任何代理,而且它可能不是防火墙(我可以ping/dig pypi.python.org)。

    经过一些额外的挖掘、运行 curl pypi.python.org 发出相同的错误: curl: (55) getpeername() failed with errno 22: Invalid argument .

    1 回复  |  直到 8 年前
        1
  •  5
  •   mrks_    8 年前

    推荐文章