注意事项:
- 确认自己电脑的显卡版本,RTX2060以上的显卡不兼容CUDA10.0以下的版本,也就是2060以上的显卡只能安装TF1.13及以上
- 根据需要的tensorflow版本1V还是2V,确认匹配的CUDA,CUDNN以及keras版本(2V版本不需要keras,使用tf.keras)
tensorflow各个版本的CUDA以及Cudnn版本对应关系
tensorflow对应的keras版本
具体步骤:
- 创建anaconda新环境
conda create -n TF1.13 python=3.6
,如果报HTTPERROR,将C:\Users\AdministratorName.condarc文件中的https改为http即可 activate TF1.13
激活环境,安装对应的cudatoolkit以及cudnn,使用清华镜像源时,需要确定其中是否有需要的版本。之后通过conda install cudatoolkit=10.0
以及conda install cudnn=7.6.0
安装- 去阿里云下载对应的tensorflowGPU版本并安装
- 安装sklearn以及keras对应版本,
pip install keras==2.2.4
,如果运行项目报错‘str object has no attribute decode’,将h5py降为2.10版本,即pip uninstall h5py
而后pip install h5py==2.10
- 如果运行tensorflow弹warning‘FutureWarning: Passing (type, 1) or ‘1type’ as a synonym of type is deprecated’,将numpy降到1.17以下即可