51Testing软件测试论坛

标题: Linux中安装tensorflow2.0出现如下问题 [打印本页]

作者: 测试积点老人    时间: 2020-12-1 13:48
标题: Linux中安装tensorflow2.0出现如下问题
安装代码:sudo pip install tensorflow==2.0.0-beta0
问题描述如下:
  1. ERROR: Exception:
  2. Traceback (most recent call last):
  3. File "/usr/local/lib/python3.6/dist-packages/pip/_vendor/urllib3/response.py", line 425, in _error_catcher
  4.    yield
  5. File "/usr/local/lib/python3.6/dist-packages/pip/_vendor/urllib3/response.py", line 507, in read
  6.    data = self._fp.read(amt) if not fp_closed else b""
  7. File "/usr/lib/python3.6/http/client.py", line 459, in read
  8.    n = self.readinto(b)
  9. File "/usr/lib/python3.6/http/client.py", line 503, in readinto
  10.    n = self.fp.readinto(b)
  11. File "/usr/lib/python3.6/socket.py", line 586, in readinto
  12.    return self._sock.recv_into(b)
  13. File "/usr/lib/python3.6/ssl.py", line 1012, in recv_into
  14.    return self.read(nbytes, buffer)
  15. File "/usr/lib/python3.6/ssl.py", line 874, in read
  16.    return self._sslobj.read(len, buffer)
  17. File "/usr/lib/python3.6/ssl.py", line 631, in read
  18.    v = self._sslobj.read(len, buffer)
  19. socket.timeout: The read operation timed out

  20. During handling of the above exception, another exception occurred:

  21. Traceback (most recent call last):
  22. File "/usr/local/lib/python3.6/dist-packages/pip/_internal/cli/base_command.py", line 188, in _main
  23.    status = self.run(options, args)
  24. File "/usr/local/lib/python3.6/dist-packages/pip/_internal/cli/req_command.py", line 185, in wrapper
  25.    return func(self, options, args)
  26. File "/usr/local/lib/python3.6/dist-packages/pip/_internal/commands/install.py", line 333, in run
  27.    reqs, check_supported_wheels=not options.target_dir
  28. File "/usr/local/lib/python3.6/dist-packages/pip/_internal/resolution/legacy/resolver.py", line 179, in resolve
  29.    discovered_reqs.extend(self._resolve_one(requirement_set, req))
  30. File "/usr/local/lib/python3.6/dist-packages/pip/_internal/resolution/legacy/resolver.py", line 362, in _resolve_one
  31.    abstract_dist = self._get_abstract_dist_for(req_to_install)
  32. File "/usr/local/lib/python3.6/dist-packages/pip/_internal/resolution/legacy/resolver.py", line 314, in _get_abstract_dist_for
  33.    abstract_dist = self.preparer.prepare_linked_requirement(req)
  34. File "/usr/local/lib/python3.6/dist-packages/pip/_internal/operations/prepare.py", line 469, in prepare_linked_requirement
  35.    hashes=hashes,
  36. File "/usr/local/lib/python3.6/dist-packages/pip/_internal/operations/prepare.py", line 259, in unpack_url
  37.    hashes=hashes,
  38. File "/usr/local/lib/python3.6/dist-packages/pip/_internal/operations/prepare.py", line 130, in get_http_url
  39.    link, downloader, temp_dir.path, hashes
  40. File "/usr/local/lib/python3.6/dist-packages/pip/_internal/operations/prepare.py", line 281, in _download_http_url
  41.    for chunk in download.chunks:
  42. File "/usr/local/lib/python3.6/dist-packages/pip/_internal/cli/progress_bars.py", line 166, in iter
  43.    for x in it:
  44. File "/usr/local/lib/python3.6/dist-packages/pip/_internal/network/utils.py", line 39, in response_chunks
  45.    decode_content=False,
  46. File "/usr/local/lib/python3.6/dist-packages/pip/_vendor/urllib3/response.py", line 564, in stream
  47.    data = self.read(amt=amt, decode_content=decode_content)
  48. File "/usr/local/lib/python3.6/dist-packages/pip/_vendor/urllib3/response.py", line 529, in read
  49.    raise IncompleteRead(self._fp_bytes_read, self.length_remaining)
  50. File "/usr/lib/python3.6/contextlib.py", line 99, in __exit__
  51.    self.gen.throw(type, value, traceback)
  52. File "/usr/local/lib/python3.6/dist-packages/pip/_vendor/urllib3/response.py", line 430, in _error_catcher
  53.    raise ReadTimeoutError(self._pool, None, "Read timed out.")
  54. pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.
复制代码
求解决方法

作者: bellas    时间: 2020-12-2 10:29
切换一下pip源
作者: qqq911    时间: 2020-12-2 10:41
超时了,检查下网络
作者: 海海豚    时间: 2020-12-2 11:57
在命令后面加上-i参数:
sudo pip install tensorflow==2.0.0-beta0 -i https://pypi.tuna.tsinghua.edu.cn/simple
作者: jingzizx    时间: 2020-12-2 13:19
试试楼上的方法
作者: 郭小贱    时间: 2020-12-2 13:32
更换一下pip源,换成国内的清华源或者豆瓣试试




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2