适用于CPU的Tensorflow 1.9,无需GPU仍需要cudNN-Windows [英] Tensorflow 1.9 for CPU, without GPU still requires cudNN - Windows

查看:366
本文介绍了适用于CPU的Tensorflow 1.9,无需GPU仍需要cudNN-Windows的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用python 3.6.3并使用tensorflow 1.9,pip 18.0的Win10机器上工作.根据此 link1 ,我没有提供使用gpu安装tensorflow的选项. ,我用

I am working on a Win10 machine, with python 3.6.3 and using tensorflow 1.9, pip 18.0. I did not provide an option to install tensorflow with gpu, (i.e.), according to this link1, I used

    pip install tensorflow

,并且未提供使用GPU的选项.但是,当尝试导入张量流时,我遇到以下错误

and did not provide option for using GPU. However, when trying to import tensorflow, I am faced with the following error

    ModuleNotFoundError: No module named '_pywrap_tensorflow_internal'

在跟踪了各种链接之后, link2 link3 ,我安装了 Visual Studio更新3 ,并且还使用了 tensorflow自检提供的脚本,并遇到了以下错误:

After following various links, link2,link3, I installed the Visual studio update 3 and also used the script provided tensorflow self check, and came across this following error:

    Could not load 'cudart64_80.dll'. .....
    Could not load 'nvcuda.dll' .......
    Could not load 'cudnn64_5.dll' ........

当我在没有GPU的情况下安装Tensorflow时,为什么要寻找这些软件包?我的系统目前没有GPU.我尝试使用升级的pip 18.0 进行卸载和重新安装,但是问题仍然存在.该如何纠正??

Why is my Tensorflow looking for these packages, when I installed it without GPU? MY system doesn't house a GPU at the moment. I tried uninstall and reinstalling with the upgraded pip 18.0, but the issue persists. How can this be rectified.?

推荐答案

该链接中的自检脚本被标记为已弃用",因此它可能不适用于最新版本(至少不适用于具有GPU的TensorFlow 1.9,因为则需要cudart64_90.dll而不是cudart64_80.dll).此外,该脚本仅检查CPU或GPU版本可能需要的所有可能的丢失文件.详细消息会告诉您仅GPU版本需要哪些文件.

The self-check script from that link is labeled as "DEPRECATED" so it may not work for the latest version (at least not for TensorFlow 1.9 with GPU since that would require cudart64_90.dll instead of cudart64_80.dll). Also, the script simply checks all possible missing files which could be needed by either the CPU or the GPU version. The detailed message tells you which files are only needed by the GPU version.

如果不确定,请首先通过执行pip show tensorflow-gpu再次检查是否未安装GPU版本.如果仅安装了CPU版本,则应该没有任何显示.

You may first double-check the GPU version is not installed, if you are not sure about it, by executing pip show tensorflow-gpu. There should be nothing showing up if you have only installed the CPU version.

昨天我在将GPU版本从1.8升级到1.9时遇到了问题.该问题可能与您的问题不完全相同,但可能是相关的,因为我的问题也是由于DLL加载失败而导致的_pywrap_tensorflow_internal导入失败.如果您的问题也是由 DLL加载失败(在堆栈跟踪消息中明确提到)引起的,则可以考虑使用此方法来查明问题:

I encountered a problem yesterday while upgrading the GPU version from 1.8 to 1.9. The problem might not be exactly the same as yours but could be related since my problem was also caused by a failed _pywrap_tensorflow_internal import due to a DLL loading failure. If your problem is also caused by a DLL loading failure, which is explicitly mentioned in the stack trace message, you could consider using this approach to pinpoint the problem:

  1. 使用DLL依赖关系分析器依赖关系分析<Your Python Dir>\Lib\site-packages\tensorflow\python\_pywrap_tensorflow_internal.pyd并确定确切的缺失DLL(由DLL旁边的?表示).

  1. Use the DLL dependency analyzer Dependencies to analyze <Your Python Dir>\Lib\site-packages\tensorflow\python\_pywrap_tensorflow_internal.pyd and determine the exact missing DLL (indicated by a ? beside the DLL).

查找丢失的DLL的信息,然后安装适当的软件包以解决问题.

Look for information of the missing DLL and install the appropriate package to resolve the problem.

在我的情况下,缺少的库是VCOMP140.dll,它是Microsoft的OpenMP库,而1.8版本不需要.我安装了针对VS 2017的VC ++可再发行版,问题就解决了.

In my case the missing library is VCOMP140.dll, which is Microsoft's OpenMP library and was not needed by the 1.8 version. I installed VC++ Redistributable for VS 2017 and the problem is resolved.

这篇关于适用于CPU的Tensorflow 1.9,无需GPU仍需要cudNN-Windows的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆