Anaconda3安装tensorflow2.2踩坑记录
本次安装是在py版本为3.6的虚拟环境下安装:
首先激活环境 activate py36(name)
activate py36
然后下载
pip install TensorFlow
出现报错
查了资料改用清华镜像源重新安装
pip install tensorflow -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
重新安装成功。
本身的虚拟环境中还是缺少很多包的,但在安装TensorFlow的过程中,它默认顺便下载安装了
输入 conda list 查看库
import tensorflow
找不到模块
查了TensorFlow2.2的相关资料 发现2.1以上版本必须是2019版的Redistributable(x64)。接着,微软官网上并没有单独的19版,而是有一个15、17、19通用版,就要这个!
下载地址为:
官方下载(Microsoft Visual C++ 2015-2019 Redistributable – 14.27.29016(适用Windows 7或更高版)
x86
x64
官方下载(Microsoft Visual C++ 2015-2019 Redistributable – 14.26.28720.3 // 适用Windows 7以上)
x86
https://aka.ms/vs/16/release/VC_redist.x86.exe
x64
https://aka.ms/vs/16/release/VC_redist.x64.exe
在试一次 import tensorflow
结果出现
表示TensorFlow2.2版本 是支持CPU和GPU两种模式 优先考虑GPU 所以出现提示没找到CUDA 等东西
所需要使用GPU模式 还需要查到对应的 版本号进行下载配置。
下载 TensorFlow2.2 GPU版本
运行出现
Attempting to fetch value instead of handling error Internal: failed to get device attribute 13 for device 0: CUDA_ERROR_UNKNOWN: unknown error
点击显卡的驱动更新到新版本
再试一次 成功