下载cuda11.2+cudnn8.1+tensorflow-gpu2.5

下载前请先安装显卡驱动,去显卡官网找对应的驱动,英伟达4060就去英伟达官网找4060的驱动。

安装cuda11.2和cudnn8.1

要注意自己的版本,目前tensorflow-gpu2.5或最高版本tensorflow-gpu2.6只支持cuda11.2和cudnn8.1。下载cuda11.2+cudnn8.1+tensorflow-gpu2.5_第1张图片
同时cuda版本要低于显卡最高支持版本,使用命令行语句查看:

nvidia-smi

下载cuda11.2+cudnn8.1+tensorflow-gpu2.5_第2张图片
具体安装过程看cuda11.2+cudnn8.1+tensorflow2.5.0环境配置
如果要像上面的博客一样,输入nvcc -V查看版本,得先去看一下上面的博客后面写的cuda的环境配置,只看cuda使用nvcc -V只需要先配置两个路径在环境变量Path下,即:

D:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\V11.2\bin
D:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\V11.2\extras\CUPTI\lib64

这里主要讲自己安装过程遇到的问题,具体安装不多说了。

安装tensorflow-gpu2.5过程中遇到的问题——解决

这一块问题最多。
①安装过程中可能会提示你Not matching distribution found for keras nightly~=2.5.0 dev
解决:pip install tensorflow-gpu==2.5.0 -i https://pypi.org/simple/
②Error while loading conda entry point: anaconda-cloud-auth (cannot import name ‘Self’ from ‘typing_extensions’ (D:\ProgramData\anaconda3\lib\site-packages\typing_extensions.py))
解决:conda update typing_extensions
③AttributeError: module ‘numpy’ has no attribute ‘object’.
np.object was a deprecated alias for the builtin object. To avoid this error in existing code, use object by itself. Doing this will not modify any behavior and is safe.
解决:进行numpy降级,numpy 1.20 版本以上就会出现没有’object’, 但是tensorflow-gpu2.5中用到了numpy的’object’

pip install numpy==1.19.5
conda install numpy-base==1.19.5

如果pip install numpy==1.19.5,使用conda list numpy会出现numpy已降级,但numpy-base还是高版本,所以也应进行降级。

如果在安装过程中,打不开anaconda navigator图形化界面了

pip uninstall typing_extensions
conda remove typing_extensions
conda install typing_extensions

参考博文

No matching distribution found for keras-nightly~=2.5.0.dev
安装cuda+cudnn+tensorflow+torch及anaconda虚拟环境配置
cuda11.2+cudnn8.1+tensorflow2.5.0环境配置
(2024)AttributeError: module ‘numpy‘ has no attribute ‘object‘.

你可能感兴趣的:(深度学习,tensorflow,人工智能)