硒安装中的错误

时间:2017-06-27 17:08:53

标签: python selenium pip

C:\Users\Suyash>pip install selenium
Collecting selenium
  Downloading selenium-3.4.3-py2.py3-none-any.whl (931kB)
    72% |███████████████████████▏        | 675kB 3.2kB/s eta 0:01:20Exception:
Traceback (most recent call last):
  File "c:\python\lib\site-packages\pip\_vendor\requests\packages\urllib3\response.py", line 232, in _error_catcher
    yield
  File "c:\python\lib\site-packages\pip\_vendor\requests\packages\urllib3\response.py", line 314, in read
    data = self._fp.read(amt)
  File "c:\python\lib\site-packages\pip\_vendor\cachecontrol\filewrapper.py", line 60, in read
    data = self.__fp.read(amt)
  File "c:\python\lib\http\client.py", line 449, in read
    n = self.readinto(b)
  File "c:\python\lib\http\client.py", line 493, in readinto
    n = self.fp.readinto(b)
  File "c:\python\lib\socket.py", line 586, in readinto
    return self._sock.recv_into(b)
  File "c:\python\lib\ssl.py", line 1002, in recv_into
    return self.read(nbytes, buffer)
  File "c:\python\lib\ssl.py", line 865, in read
    return self._sslobj.read(len, buffer)
  File "c:\python\lib\ssl.py", line 625, in read
    v = self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\python\lib\site-packages\pip\basecommand.py", line 215, in main
    status = self.run(options, args)
  File "c:\python\lib\site-packages\pip\commands\install.py", line 324, in run
    requirement_set.prepare_files(finder)
  File "c:\python\lib\site-packages\pip\req\req_set.py", line 380, in prepare_files
    ignore_dependencies=self.ignore_dependencies))
  File "c:\python\lib\site-packages\pip\req\req_set.py", line 620, in _prepare_file
    session=self.session, hashes=hashes)
  File "c:\python\lib\site-packages\pip\download.py", line 821, in unpack_url
    hashes=hashes
  File "c:\python\lib\site-packages\pip\download.py", line 659, in unpack_http_url
    hashes)
  File "c:\python\lib\site-packages\pip\download.py", line 882, in _download_http_url
    _download_url(resp, link, content_file, hashes)
  File "c:\python\lib\site-packages\pip\download.py", line 603, in _download_url
    hashes.check_against_chunks(downloaded_chunks)
  File "c:\python\lib\site-packages\pip\utils\hashes.py", line 46, in check_against_chunks
    for chunk in chunks:
  File "c:\python\lib\site-packages\pip\download.py", line 571, in written_chunks
    for chunk in chunks:
  File "c:\python\lib\site-packages\pip\utils\ui.py", line 139, in iter
    for x in it:
  File "c:\python\lib\site-packages\pip\download.py", line 560, in resp_read
    decode_content=False):
  File "c:\python\lib\site-packages\pip\_vendor\requests\packages\urllib3\response.py", line 357, in stream
    data = self.read(amt=amt, decode_content=decode_content)
  File "c:\python\lib\site-packages\pip\_vendor\requests\packages\urllib3\response.py", line 324, in read
    flush_decoder = True
  File "c:\python\lib\contextlib.py", line 100, in __exit__
    self.gen.throw(type, value, traceback)
  File "c:\python\lib\site-packages\pip\_vendor\requests\packages\urllib3\response.py", line 237, in _error_catcher
    raise ReadTimeoutError(self._pool, None, 'Read timed out.')
pip._vendor.requests.packages.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='pypi.python.org', port=443): Read timed out.

即使我使用pip3.6或pip3

,我也会收到类似的错误
C:\Users\Suyash>pip3.6 install selenium
Collecting selenium
  Downloading selenium-3.4.3-py2.py3-none-any.whl (931kB)
    49% |███████████████▉                | 460kB 3.4kB/s eta 0:02:21Exception:
Traceback (most recent call last):
  File "c:\python\lib\site-packages\pip\_vendor\requests\packages\urllib3\response.py", line 232, in _error_catcher
    yield
  File "c:\python\lib\site-packages\pip\_vendor\requests\packages\urllib3\response.py", line 314, in read
    data = self._fp.read(amt)
  File "c:\python\lib\site-packages\pip\_vendor\cachecontrol\filewrapper.py", line 60, in read
    data = self.__fp.read(amt)
  File "c:\python\lib\http\client.py", line 449, in read
    n = self.readinto(b)
  File "c:\python\lib\http\client.py", line 493, in readinto
    n = self.fp.readinto(b)
  File "c:\python\lib\socket.py", line 586, in readinto
    return self._sock.recv_into(b)
  File "c:\python\lib\ssl.py", line 1002, in recv_into
    return self.read(nbytes, buffer)
  File "c:\python\lib\ssl.py", line 865, in read
    return self._sslobj.read(len, buffer)
  File "c:\python\lib\ssl.py", line 625, in read
    v = self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\python\lib\site-packages\pip\basecommand.py", line 215, in main
    status = self.run(options, args)
  File "c:\python\lib\site-packages\pip\commands\install.py", line 324, in run
    requirement_set.prepare_files(finder)
  File "c:\python\lib\site-packages\pip\req\req_set.py", line 380, in prepare_files
    ignore_dependencies=self.ignore_dependencies))
  File "c:\python\lib\site-packages\pip\req\req_set.py", line 620, in _prepare_file
    session=self.session, hashes=hashes)
  File "c:\python\lib\site-packages\pip\download.py", line 821, in unpack_url
    hashes=hashes
  File "c:\python\lib\site-packages\pip\download.py", line 659, in unpack_http_url
    hashes)
  File "c:\python\lib\site-packages\pip\download.py", line 882, in _download_http_url
    _download_url(resp, link, content_file, hashes)
  File "c:\python\lib\site-packages\pip\download.py", line 603, in _download_url
    hashes.check_against_chunks(downloaded_chunks)
  File "c:\python\lib\site-packages\pip\utils\hashes.py", line 46, in check_against_chunks
    for chunk in chunks:
  File "c:\python\lib\site-packages\pip\download.py", line 571, in written_chunks
    for chunk in chunks:
  File "c:\python\lib\site-packages\pip\utils\ui.py", line 139, in iter
    for x in it:
  File "c:\python\lib\site-packages\pip\download.py", line 560, in resp_read
    decode_content=False):
  File "c:\python\lib\site-packages\pip\_vendor\requests\packages\urllib3\response.py", line 357, in stream
    data = self.read(amt=amt, decode_content=decode_content)
  File "c:\python\lib\site-packages\pip\_vendor\requests\packages\urllib3\response.py", line 324, in read
    flush_decoder = True
  File "c:\python\lib\contextlib.py", line 100, in __exit__
    self.gen.throw(type, value, traceback)
  File "c:\python\lib\site-packages\pip\_vendor\requests\packages\urllib3\response.py", line 237, in _error_catcher
    raise ReadTimeoutError(self._pool, None, 'Read timed out.')
pip._vendor.requests.packages.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='pypi.python.org', port=443): Read timed out.

这是我在尝试安装selenium模块时遇到的错误 我试图卸载并重新安装python也添加到路径文件夹但仍然出现这些错误我目前正在使用Windows 10(最新更新)所以我不认为这应该是一个问题,请帮助修复

提前感谢您的帮助

1 个答案:

答案 0 :(得分:1)

ReadTimeoutErrors主要是因为网络问题而发生的。如果互联网连接中断或太慢,可能会发生这种情况。一个可能的解决方案是使用pip install命令传递增加的default-timeout标志,如下所示:

pip install selenium --default-timeout=100

如果100没有切断它,请尝试使用200。

希望这有帮助!