anaconda安装tensorflow遇到的问题

  1. 报错信息:
CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/noarch/repodata.json>
Elapsed: -
An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your way.
SSLError(MaxRetryError('HTTPSConnectionPool(host=\'mirrors.tuna.tsinghua.edu.cn\', port=443): Max retries exceeded with url: /anaconda/pkgs/free/noarch/repodata.json (Caused by SSLError(SSLError("bad handshake: Error([(\'SSL routines\', \'ssl3_get_server_certificate\', \'certificate verify failed\')],)",),))',),)

解决方法:
找到文件.condarc,路径在C盘,ssl_verify改为false

channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
#  - defaults
ssl_verify: false
show_channel_urls: true
  1. anaconda navigator打开时报错 there is an instance of anaconda vavigator already running. 资源管理器也找不到后台进程。
    解决方法:打开cmd,taskkill掉
C:\Users\...>tasklist | findstr "pythonw"
pythonw.exe                   7876 Console                    1     16,572 K
pythonw.exe                   9072 Console                    1    245,688 K

C:\Users\...>taskkill /pid 9072 /f
成功: 已终止 PID 为 9072 的进程。
  1. anaconda navigator打开时卡在加载阶段
    解决方法:
    anaconda3\Lib\site-packages\anaconda_navigator\api\conda_api.py 找到data = yaml.load(f) 改为 data = yaml.safeload(f)

  2. 报错信息:dlerror: cudart64_110.dll not found
    解决方法:
    在网站官网下载文件之后解压,根据自己的电脑复制到对应位置(C:\Windows\System32),然后重启 。

    解决方法(更改):
    猜测是由于下载的tensorflow-gpu版本与CUDA支持的版本不匹配造成的,在【桌面>NVIDIA控制面板>帮助>系统信息>组件】找到CUDA版本,然后在tensorflow官网找到对应的版本,重新安装tensorflow
    最后根据这篇 tensorflow-gpu2.3.0+cuda10.1+cudnn7.6.5.32完成了安装(记得重启anaconda prompt)

  3. 测试代码
    在pycharm中写入如下代码:

import tensorflow as tf

tensorflow_version = tf.__version__
gpu_available = tf.test.is_gpu_available()

print("tensorflow version:",gpu_available)

a = tf.constant([1.0, 2.0], name="a")
b = tf.constant([1.0, 2.0], name="b")
result = tf.add(a, b, name="add")
print(result)

输出:tf.Tensor([2. 4.], shape=(2,), dtype=float32)

一些参考文章:
Anaconda环境下Tensorflow的安装与卸载
Window10上Tensorflow的安装(CPU和GPU版本)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值