【问题标题】:How to solve the error in installing Tensorflow?如何解决安装Tensorflow的错误?
【发布时间】:2021-02-27 07:06:58
【问题描述】:

我尝试使用 pip install tensorflow 安装 TensorFlow,但出现以下错误。是因为超时问题吗?安装TensorFlow时如何解决这个错误?

ERROR: Exception:
Traceback (most recent call last):
  File "c:\users\hp\appdata\local\programs\python\python38\lib\site-packages\pip\_vendor\urllib3\response.py", line 425, in _error_catcher
    yield
  File "c:\users\hp\appdata\local\programs\python\python38\lib\site-packages\pip\_vendor\urllib3\response.py", line 507, in read
    data = self._fp.read(amt) if not fp_closed else b""
  File "c:\users\hp\appdata\local\programs\python\python38\lib\site-packages\pip\_vendor\cachecontrol\filewrapper.py", line 62, in read
    data = self.__fp.read(amt)
  File "c:\users\hp\appdata\local\programs\python\python38\lib\http\client.py", line 454, in read
    n = self.readinto(b)
  File "c:\users\hp\appdata\local\programs\python\python38\lib\http\client.py", line 498, in readinto
    n = self.fp.readinto(b)
  File "c:\users\hp\appdata\local\programs\python\python38\lib\socket.py", line 669, in readinto
    return self._sock.recv_into(b)
  File "c:\users\hp\appdata\local\programs\python\python38\lib\ssl.py", line 1241, in recv_into
    return self.read(nbytes, buffer)
  File "c:\users\hp\appdata\local\programs\python\python38\lib\ssl.py", line 1099, in read
    return self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out

【问题讨论】:

  • 您使用的是 conda 环境吗?如果不尝试:pip --default-timeout=300 install tensorflow

标签: python tensorflow machine-learning pip


【解决方案1】:

如果您使用conda 首次运行:

conda config --set ssl_verify no

之后修改你的默认超时时间:

pip --default-timeout=900 install tensorflow 

注意:conda config --set ssl_verify no 仅适用于 conda,如果您不在 conda 环境中,请跳过此步骤。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-03-22
    • 1970-01-01
    • 2020-02-05
    • 2019-05-29
    • 2020-08-28
    • 2021-04-12
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多