【发布时间】:2018-05-11 16:16:11
【问题描述】:
按照 TF 和 NVIDIA 网站上的说明安装 CUDA 9.0 和 cuDNN 7.0 后,我从 PyCharm 包管理器下载并安装了 TensorFlow 1.8.0 和 TensorFlow-gpu 1.8.0,以便我可以使用笔记本电脑的 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 的环境变量可能是问题所在,所以我尝试了一下:
但这也不起作用。我知道所有的库和依赖项都在工作,因为我可以从命令提示符导入 TensorFlow。事实上,在我的计算机中,我创建了一个不同的用户帐户并在那里使用 PyCharm 导入 TensorFlow,它再次运行良好。我怀疑这与我的 PyCharm 使用的解释器有关,因为这是两个用户帐户之间的唯一区别。在工作的用户帐户上,我以前没有安装过 Anaconda3,而在我没有工作的用户帐户上,其各自的 PyCharm 正在使用位于 Anaconda3 文件中的解释器。我怎样才能解决这个问题?
【问题讨论】:
-
如果从pycharm中的python脚本打印出系统路径是否正确?
-
@geometrikal 当我打印 print(sys.path) 时,我在 PyCharm(我遇到问题的地方)和命令提示符(它确实工作的地方)中都得到了相同的输出。实际上,当我在 PyCharm 中打印出来时,我会得到额外的目录。
标签: python tensorflow pycharm