日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > windows >内容正文

windows

windows下tensorflow安装

發布時間:2025/3/16 windows 33 豆豆
生活随笔 收集整理的這篇文章主要介紹了 windows下tensorflow安装 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

1.安裝一定要用CUDA8, 安裝了半天用CUDA9,結果是搞不了


2.其實anaconda 裝tensorflow cpu或者GPU都是超級簡單的直接在Navigator 里面配置就行了,網絡上的都寫的太復雜

3.記得配置環境變量.



配置環境變量的話https://jingyan.baidu.com/article/3ea51489e1c2b752e61bbad0.html

最后在cmd里輸入 echo %path% ?就能查看你的是否添加進環境變量了


4.幫助文檔

[python] view plain copy print?
  • import?ctypes??
  • import?imp??
  • import?sys??
  • ??
  • ??
  • def?main():??
  • ????try:??
  • ????????import?tensorflow?as?tf??
  • ????????print(“TensorFlow?successfully?installed.”)??
  • ????????if?tf.test.is_built_with_cuda():??
  • ????????????print(“The?installed?version?of?TensorFlow?includes?GPU?support.”)??
  • ????????else:??
  • ????????????print(“The?installed?version?of?TensorFlow?does?not?include?GPU?support.”)??
  • ????????sys.exit(0)??
  • ????except?ImportError:??
  • ????????print(“ERROR:?Failed?to?import?the?TensorFlow?module.”)??
  • ??
  • ????candidate_explanation?=?False??
  • ??
  • ????python_version?=?sys.version_info.major,?sys.version_info.minor??
  • ????print(“\n-?Python?version?is?%d.%d.”?%?python_version)??
  • ????if?not?(python_version?==?(3,?5)?or?python_version?==?(3,?6)):??
  • ????????candidate_explanation?=?True??
  • ????????print(“-?The?official?distribution?of?TensorFlow?for?Windows?requires?”??
  • ??????????????”Python?version?3.5?or?3.6.”)??
  • ??
  • ????try:??
  • ????????_,?pathname,?_?=?imp.find_module(”tensorflow”)??
  • ????????print(“\n-?TensorFlow?is?installed?at:?%s”?%?pathname)??
  • ????except?ImportError:??
  • ????????candidate_explanation?=?False??
  • ????????print(“”“?
  • -?No?module?named?TensorFlow?is?installed?in?this?Python?environment.?You?may?
  • ??install?it?using?the?command?`pip?install?tensorflow`.”“”)??
  • ??
  • ????try:??
  • ????????msvcp140?=?ctypes.WinDLL(”msvcp140.dll”)??
  • ????except?OSError:??
  • ????????candidate_explanation?=?True??
  • ????????print(“”“?
  • -?Could?not?load?‘msvcp140.dll’.?TensorFlow?requires?that?this?DLL?be?
  • ??installed?in?a?directory?that?is?named?in?your?%PATH%?environment?
  • ??variable.?You?may?install?this?DLL?by?downloading?Microsoft?Visual?
  • ??C++?2015?Redistributable?Update?3?from?this?URL:?
  • ??https://www.microsoft.com/en-us/download/details.aspx?id=53587”“”)??
  • ??
  • ????try:??
  • ????????cudart64_80?=?ctypes.WinDLL(”cudart64_80.dll”)??
  • ????except?OSError:??
  • ????????candidate_explanation?=?True??
  • ????????print(“”“?
  • -?Could?not?load?‘cudart64_80.dll’.?The?GPU?version?of?TensorFlow?
  • ??requires?that?this?DLL?be?installed?in?a?directory?that?is?named?in?
  • ??your?%PATH%?environment?variable.?Download?and?install?CUDA?8.0?from?
  • ??this?URL:?https://developer.nvidia.com/cuda-toolkit”“”)??
  • ??
  • ????try:??
  • ????????nvcuda?=?ctypes.WinDLL(”nvcuda.dll”)??
  • ????except?OSError:??
  • ????????candidate_explanation?=?True??
  • ????????print(“”“?
  • -?Could?not?load?‘nvcuda.dll’.?The?GPU?version?of?TensorFlow?requires?that?
  • ??this?DLL?be?installed?in?a?directory?that?is?named?in?your?%PATH%?
  • ??environment?variable.?Typically?it?is?installed?in?‘C:\Windows\System32’.?
  • ??If?it?is?not?present,?ensure?that?you?have?a?CUDA-capable?GPU?with?the?
  • ??correct?driver?installed.”“”)??
  • ??
  • ????cudnn5_found?=?False??
  • ????try:??
  • ????????cudnn5?=?ctypes.WinDLL(”cudnn64_5.dll”)??
  • ????????cudnn5_found?=?True??
  • ????except?OSError:??
  • ????????candidate_explanation?=?True??
  • ????????print(“”“?
  • -?Could?not?load?‘cudnn64_5.dll’.?The?GPU?version?of?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?it?is?often?found?in?a?
  • ??different?directory?from?the?CUDA?DLLs.?You?may?install?the?
  • ??necessary?DLL?by?downloading?cuDNN?5.1?from?this?URL:?
  • ??https://developer.nvidia.com/cudnn”“”)??
  • ??
  • ????cudnn6_found?=?False??
  • ????try:??
  • ????????cudnn?=?ctypes.WinDLL(”cudnn64_6.dll”)??
  • ????????cudnn6_found?=?True??
  • ????except?OSError:??
  • ????????candidate_explanation?=?True??
  • ??
  • ????if?not?cudnn5_found?or?not?cudnn6_found:??
  • ????????print()??
  • ????????if?not?cudnn5_found?and?not?cudnn6_found:??
  • ????????????print(“-?Could?not?find?cuDNN.”)??
  • ????????elif?not?cudnn5_found:??
  • ????????????print(“-?Could?not?find?cuDNN?5.1.”)??
  • ????????else:??
  • ????????????print(“-?Could?not?find?cuDNN?6.”)??
  • ????????????print(“”“?
  • ??The?GPU?version?of?TensorFlow?requires?that?the?correct?cuDNN?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?it?is?often?
  • ??found?in?a?different?directory?from?the?CUDA?DLLs.?The?correct?version?of?
  • ??cuDNN?depends?on?your?version?of?TensorFlow:?
  • ?
  • ??*?TensorFlow?1.2.1?or?earlier?requires?cuDNN?5.1.?(‘cudnn64_5.dll’)?
  • ??*?TensorFlow?1.3?or?later?requires?cuDNN?6.?(‘cudnn64_6.dll’)?
  • ?
  • ??You?may?install?the?necessary?DLL?by?downloading?cuDNN?from?this?URL:?
  • ??https://developer.nvidia.com/cudnn”“”)??
  • ??
  • ????if?not?candidate_explanation:??
  • ????????print(“”“?
  • -?All?required?DLLs?appear?to?be?present.?Please?open?an?issue?on?the?
  • ??TensorFlow?GitHub?page:?https://github.com/tensorflow/tensorflow/issues”“”)??
  • ??
  • ????sys.exit(-1)??
  • ??
  • ??
  • if?__name__?==?“__main__”:??
  • ????main()??
  • import ctypes import imp import sysdef main():try:import tensorflow as tfprint("TensorFlow successfully installed.")if tf.test.is_built_with_cuda():print("The installed version of TensorFlow includes GPU support.")else:print("The installed version of TensorFlow does not include GPU support.")sys.exit(0)except ImportError:print("ERROR: Failed to import the TensorFlow module.")candidate_explanation = Falsepython_version = sys.version_info.major, sys.version_info.minorprint("\n- Python version is %d.%d." % python_version)if not (python_version == (3, 5) or python_version == (3, 6)):candidate_explanation = Trueprint("- The official distribution of TensorFlow for Windows requires ""Python version 3.5 or 3.6.")try:_, pathname, _ = imp.find_module("tensorflow")print("\n- TensorFlow is installed at: %s" % pathname)except ImportError:candidate_explanation = Falseprint(""" - No module named TensorFlow is installed in this Python environment. You mayinstall it using the command `pip install tensorflow`.""")try:msvcp140 = ctypes.WinDLL("msvcp140.dll")except OSError:candidate_explanation = Trueprint(""" - Could not load 'msvcp140.dll'. TensorFlow requires that this DLL beinstalled in a directory that is named in your %PATH% environmentvariable. You may install this DLL by downloading Microsoft VisualC++ 2015 Redistributable Update 3 from this URL:https://www.microsoft.com/en-us/download/details.aspx?id=53587""")try:cudart64_80 = ctypes.WinDLL("cudart64_80.dll")except OSError:candidate_explanation = Trueprint(""" - Could not load 'cudart64_80.dll'. The GPU version of TensorFlowrequires that this DLL be installed in a directory that is named inyour %PATH% environment variable. Download and install CUDA 8.0 fromthis URL: https://developer.nvidia.com/cuda-toolkit""")try:nvcuda = ctypes.WinDLL("nvcuda.dll")except OSError:candidate_explanation = Trueprint(""" - Could not load 'nvcuda.dll'. The GPU version of TensorFlow requires thatthis DLL be installed in a directory that is named in your %PATH%environment variable. Typically it is installed in 'C:\Windows\System32'.If it is not present, ensure that you have a CUDA-capable GPU with thecorrect driver installed.""")cudnn5_found = Falsetry:cudnn5 = ctypes.WinDLL("cudnn64_5.dll")cudnn5_found = Trueexcept OSError:candidate_explanation = Trueprint(""" - Could not load 'cudnn64_5.dll'. The GPU version of TensorFlowrequires that this DLL be installed in a directory that is named inyour %PATH% environment variable. Note that installing cuDNN is aseparate step from installing CUDA, and it is often found in adifferent directory from the CUDA DLLs. You may install thenecessary DLL by downloading cuDNN 5.1 from this URL:https://developer.nvidia.com/cudnn""")cudnn6_found = Falsetry:cudnn = ctypes.WinDLL("cudnn64_6.dll")cudnn6_found = Trueexcept OSError:candidate_explanation = Trueif not cudnn5_found or not cudnn6_found:print()if not cudnn5_found and not cudnn6_found:print("- Could not find cuDNN.")elif not cudnn5_found:print("- Could not find cuDNN 5.1.")else:print("- Could not find cuDNN 6.")print("""The GPU version of TensorFlow requires that the correct cuDNN DLL be installedin a directory that is named in your %PATH% environment variable. Note thatinstalling cuDNN is a separate step from installing CUDA, and it is oftenfound in a different directory from the CUDA DLLs. The correct version ofcuDNN depends on your version of TensorFlow:* TensorFlow 1.2.1 or earlier requires cuDNN 5.1. ('cudnn64_5.dll')* TensorFlow 1.3 or later requires cuDNN 6. ('cudnn64_6.dll')You may install the necessary DLL by downloading cuDNN from this URL:https://developer.nvidia.com/cudnn""")if not candidate_explanation:print(""" - All required DLLs appear to be present. Please open an issue on theTensorFlow GitHub page: https://github.com/tensorflow/tensorflow/issues""")sys.exit(-1)if __name__ == "__main__":main()

    我只是簡要的說明了一下,可以先看http://blog.csdn.net/sb19931201/article/details/53648615? 如果還不行,再評論問吧

    總結

    以上是生活随笔為你收集整理的windows下tensorflow安装的全部內容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。