解决在安装tensorflow-gpu时遇到-KeyError: ‘tensorflow‘错误


1、报错内容

错误如下(示例):

ERROR: Exception:
Traceback (most recent call last):
  File "/home/guest/anaconda3/envs/tf_1.8/lib/python3.6/site-packages/pip/_vendor/resolvelib/resolvers.py", line 171, in _merge_into_criterion
    crit = self.state.criteria[name]
KeyError: 'numpy'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/guest/anaconda3/envs/tf_1.8/lib/python3.6/site-packages/pip/_vendor/urllib3/response.py", line 438, in _error_catcher
    yield
  File "/home/guest/anaconda3/envs/tf_1.8/lib/python3.6/site-packages/pip/_vendor/urllib3/response.py", line 519, in read
    data = self._fp.read(amt) if not fp_closed else b""
  File "/home/guest/anaconda3/envs/tf_1.8/lib/python3.6/site-packages/pip/_vendor/cachecontrol/filewrapper.py", line 62, in read
    data = self.__fp.read(amt)
  File "/home/guest/anaconda3/envs/tf_1.8/lib/python3.6/http/client.py", line 463, in read
    n = self.readinto(b)
  File "/home/guest/anaconda3/envs/tf_1.8/lib/python3.6/http/client.py", line 507, in readinto
    n = self.fp.readinto(b)
  File "/home/guest/anaconda3/envs/tf_1.8/lib/python3.6/socket.py", line 586, in readinto
    return self._sock.recv_into(b)
  File "/home/guest/anaconda3/envs/tf_1.8/lib/python3.6/ssl.py", line 1012, in recv_into
    return self.read(nbytes, buffer)
  File "/home/guest/anaconda3/envs/tf_1.8/lib/python3.6/ssl.py", line 874, in read
    return self._sslobj.read(len, buffer)
  File "/home/guest/anaconda3/envs/tf_1.8/lib/python3.6/ssl.py", line 631, 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 "/home/guest/anaconda3/envs/tf_1.8/lib/python3.6/site-packages/pip/_internal/cli/base_command.py", line 189, in _main
    status = self.run(options, args)
  File "/home/guest/anaconda3/envs/tf_1.8/lib/python3.6/site-packages/pip/_internal/cli/req_command.py", line 178, in wrapper
    return func(self, options, args)
  File "/home/guest/anaconda3/envs/tf_1.8/lib/python3.6/site-packages/pip/_internal/commands/install.py", line 317, in run
    reqs, check_supported_wheels=not options.target_dir
  File "/home/guest/anaconda3/envs/tf_1.8/lib/python3.6/site-packages/pip/_internal/resolution/resolvelib/resolver.py", line 122, in resolve
    requirements, max_rounds=try_to_avoid_resolution_too_deep,
  File "/home/guest/anaconda3/envs/tf_1.8/lib/python3.6/site-packages/pip/_vendor/resolvelib/resolvers.py", line 453, in resolve
    state = resolution.resolve(requirements, max_rounds=max_rounds)
  File "/home/guest/anaconda3/envs/tf_1.8/lib/python3.6/site-packages/pip/_vendor/resolvelib/resolvers.py", line 347, in resolve
    failure_causes = self._attempt_to_pin_criterion(name, criterion)
  File "/home/guest/anaconda3/envs/tf_1.8/lib/python3.6/site-packages/pip/_vendor/resolvelib/resolvers.py", line 207, in _attempt_to_pin_criterion
    criteria = self._get_criteria_to_update(candidate)
  File "/home/guest/anaconda3/envs/tf_1.8/lib/python3.6/site-packages/pip/_vendor/resolvelib/resolvers.py", line 199, in _get_criteria_to_update
    name, crit = self._merge_into_criterion(r, parent=candidate)
  File "/home/guest/anaconda3/envs/tf_1.8/lib/python3.6/site-packages/pip/_vendor/resolvelib/resolvers.py", line 173, in _merge_into_criterion

2.解决方法

输入代码如下:

pip install tensorflow-gpu==1.8.0 --default-timeout=10000 --upgrade

总结

平时多积累,战时少犯错!完结!

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值