windows系统用anaconda安装tensorflow-gpu报错

windows系统下用anaconda prompt安装tensorflow-gpu==2.1.0时报错解决办法

报错:

1ERROR: Exception:
Traceback (most recent call last):
File “E:\Anaconda3\Anaconda2019\envs\tensorflow\lib\site-packages\pip_vendor\urllib3\response.py”, line 438, in _error_catcher
yield
File “E:\Anaconda3\Anaconda2019\envs\tensorflow\lib\site-packages\pip_vendor\urllib3\response.py”, line 519, in read
data = self._fp.read(amt) if not fp_closed else b""
File “E:\Anaconda3\Anaconda2019\envs\tensorflow\lib\site-packages\pip_vendor\cachecontrol\filewrapper.py”, line 62, in read
data = self.__fp.read(amt)
File “E:\Anaconda3\Anaconda2019\envs\tensorflow\lib\http\client.py”, line 465, in read
n = self.readinto(b)
File “E:\Anaconda3\Anaconda2019\envs\tensorflow\lib\http\client.py”, line 509, in readinto
n = self.fp.readinto(b)
File “E:\Anaconda3\Anaconda2019\envs\tensorflow\lib\socket.py”, line 589, in readinto
return self._sock.recv_into(b)
File “E:\Anaconda3\Anaconda2019\envs\tensorflow\lib\ssl.py”, line 1071, in recv_into
return self.read(nbytes, buffer)
File “E:\Anaconda3\Anaconda2019\envs\tensorflow\lib\ssl.py”, line 929, in read
return 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 “E:\Anaconda3\Anaconda2019\envs\tensorflow\lib\site-packages\pip_internal\cli\base_command.py”, line 173, in _main
status = self.run(options, args)
File “E:\Anaconda3\Anaconda2019\envs\tensorflow\lib\site-packages\pip_internal\cli\req_command.py”, line 203, in wrapper
return func(self, options, args)
File “E:\Anaconda3\Anaconda2019\envs\tensorflow\lib\site-packages\pip_internal\commands\install.py”, line 316, in run
reqs, check_supported_wheels=not options.target_dir
File “E:\Anaconda3\Anaconda2019\envs\tensorflow\lib\site-packages\pip_internal\resolution\resolvelib\resolver.py”, line 95, in resolve
collected.requirements, max_rounds=try_to_avoid_resolution_too_deep

解决方案

使用豆瓣镜像安装:当不指定版本时,默认安装最新版

pip install tensorflow-gpu==2.2.0 -i https://pypi.douban.com/simple

出现如下则成功:
…此处省略很多
Successfully built gast termcolor absl-py
Installing collected packages: keras-preprocessing, protobuf, markdown, grpcio, absl-py, tensorboard, gast, mock, tensorflow-estimator, termcolor, keras-applications, astor, tensorflow
Successfully installed absl-py-0.7.1 astor-0.8.0 gast-0.2.2 grpcio-1.20.1 keras-applications-1.0.7 keras-preprocessing-1.0.9 markdown-3.1.1 mock-3.0.5 protobuf-3.7.1 tensorboard-1.13.1 tensorflow-1.13.1 tensorflow-estimator-1.13.0 termcolor-1.1.0

安装好后检查tensorflow-gpu版本是否可用,返回结果为true则可以

import tensorflow as tf
print(tf.test.is_gpu_available())

查看版本号

import tensorflow as tf
tf.__version__

当出现I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_100.dll时,在import tensorflow as tf 前面导入import os即可。
windows系统用anaconda安装tensorflow-gpu报错_第1张图片
windows系统用anaconda安装tensorflow-gpu报错_第2张图片

windows系统用anaconda安装tensorflow-gpu报错_第3张图片

你可能感兴趣的:(深度学习)