无法从PyCharm导入TensorFlow

2024-04-20 10:21:06 发布

您现在位置:Python中文网/ 问答频道 /正文

在安装了CUDA 9.0和cuDNN 7.0之后,我从PyCharm软件包管理器下载并安装了TensorFlow 1.8.0和TensorFlow gpu 1.8.0,按照TF和NVIDIA网站的指示,这样我就可以使用笔记本电脑的gpu了。但是,每当我尝试从PyCharm导入TensorFlow时,它会抛出以下错误:

ImportError: Could not find 'cudnn64_7.dll'. TensorFlow requires that this DLL be installed in a directory that is named in your %PATH% environment variable. Note that installing cuDNN is a separate step from installing CUDA, and this DLL is often found in a different directory from the CUDA DLLs. You may install the necessary DLL by downloading cuDNN 7 from this URL: https://developer.nvidia.com/cudnn

包含cudnn64_7.dll的目录确实位于PATH环境变量中。我是PyCharm的新手,但我在另一篇文章中读到,向PyCharm的环境变量添加路径可能是个问题,所以我尝试了:

enter image description here

但这也没用。我知道所有的库和依赖项都在工作,因为我可以很好地从命令提示符导入TensorFlow。事实上,在我的电脑里,我创建了一个不同的用户帐户,并在那里使用PyCharm导入TensorFlow,它再次运行良好。我怀疑这与我的PyCharm正在使用的解释器有关,因为这是两个用户帐户之间唯一的区别。在正常工作的用户帐户上,我以前没有安装Anaconda3,而在不工作的用户帐户上,我安装了Anaconda3,而它各自的PyCharm正在使用位于Anaconda3文件中的解释器。我该怎么解决这个问题?


Tags: 用户infromthatgpuistensorflow帐户
1条回答
网友
1楼 · 发布于 2024-04-20 10:21:06

转到cuDNN存档https://developer.nvidia.com/rdp/cudnn-archive

点击“下载cuDNN v7.6.1(2019年6月24日),用于CUDA 9.0”

单击操作系统的版本

解压。应该提取到一个名为cuda的目录

复制文件夹的内容

粘贴到“C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0”

全部完成!!!在

相关问题 更多 >