簡體   English   中英

安裝Tensorflow-GPU時出錯

[英]Error installing Tensorflow-GPU

我正在嘗試按照以下說明安裝tensorflow和tensorflow-gpu:

https://www.tensorflow.org/install/install_windows#CommonInstallationProblems

我認為我正確地跟隨了他們,但是我似乎無法使其正常工作。 如果我從CMD提示符下以管理員身份運行它,兩者似乎都安裝成功。 如果我僅安裝了tensorflow后就停止了,那就可以了。 但是一旦我還安裝了tensorflow-gpu(即使它似乎安裝成功),當我嘗試使用tensorflow時也會出現錯誤。

這是我得到的錯誤:

Traceback (most recent call last):
  File "D:\Anaconda3\envs\Keras\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in swig_import_helper
    return importlib.import_module(mname)
  File "D:\Anaconda3\envs\Keras\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 986, in _gcd_import
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 666, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 577, in module_from_spec
  File "<frozen importlib._bootstrap_external>", line 919, in create_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
ImportError: DLL load failed: The specified module could not be found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "D:\Anaconda3\envs\Keras\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 41, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2017.1.4\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "D:\Anaconda3\envs\Keras\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 21, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "D:\Anaconda3\envs\Keras\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 20, in swig_import_helper
    return importlib.import_module('_pywrap_tensorflow_internal')
  File "D:\Anaconda3\envs\Keras\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ImportError: No module named '_pywrap_tensorflow_internal'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2017.1.4\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "D:\Anaconda3\envs\Keras\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
    from tensorflow.python import *
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2017.1.4\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "D:\Anaconda3\envs\Keras\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2017.1.4\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "D:\Anaconda3\envs\Keras\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 52, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "D:\Anaconda3\envs\Keras\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in swig_import_helper
    return importlib.import_module(mname)
  File "D:\Anaconda3\envs\Keras\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 986, in _gcd_import
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 666, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 577, in module_from_spec
  File "<frozen importlib._bootstrap_external>", line 919, in create_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
ImportError: DLL load failed: The specified module could not be found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "D:\Anaconda3\envs\Keras\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 41, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2017.1.4\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "D:\Anaconda3\envs\Keras\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 21, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "D:\Anaconda3\envs\Keras\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 20, in swig_import_helper
    return importlib.import_module('_pywrap_tensorflow_internal')
  File "D:\Anaconda3\envs\Keras\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ImportError: No module named '_pywrap_tensorflow_internal'
Failed to load the native TensorFlow runtime.
See https://www.tensorflow.org/install/install_sources#common_installation_problems
for some common reasons and solutions.  Include the entire stack trace
above this error message when asking for help.

我正在通過以管理員身份運行並帶有激活運行的CMD提示符進行此安裝。 我在PyCharm中也嘗試過類似的結果。

說明說即使我計划使用tensorflow-gpu,也應該安裝常規的tensorflow。

但是我嘗試僅安裝tensorflow-gpu,盡管安裝成功,但運行“將tensorflow作為tf導入”時仍然出現上述錯誤。

因此,我似乎可以使它正常工作的唯一方法是不安裝tensorflow-gpu。 但是,這樣做的全部原因是我可以將我的NVIDIA GPU與Keras / Tensorflow結合使用。

注意:我確實安裝了CUDA Toolkit 8.0和cuDNN v5.1,盡管該過程很麻煩,所以可能我做錯了。 我認為沒有簡單的方法可以驗證它。

對於踢,我嘗試先安裝tensorflow-gpu,然后在僅安裝tensorflow時遇到以下錯誤-盡管是管理員,這是一個權限錯誤:

Exception:
Traceback (most recent call last):
  File "D:\Anaconda3\envs\Keras\lib\site-packages\pip\basecommand.py", line 215, in main
    status = self.run(options, args)
  File "D:\Anaconda3\envs\Keras\lib\site-packages\pip\commands\install.py", line 342, in run
    prefix=options.prefix_path,
  File "D:\Anaconda3\envs\Keras\lib\site-packages\pip\req\req_set.py", line 784, in install
    **kwargs
  File "D:\Anaconda3\envs\Keras\lib\site-packages\pip\req\req_install.py", line 851, in install
    self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
  File "D:\Anaconda3\envs\Keras\lib\site-packages\pip\req\req_install.py", line 1064, in move_wheel_files
    isolated=self.isolated,
  File "D:\Anaconda3\envs\Keras\lib\site-packages\pip\wheel.py", line 345, in move_wheel_files
    clobber(source, lib_dir, True)
  File "D:\Anaconda3\envs\Keras\lib\site-packages\pip\wheel.py", line 323, in clobber
    shutil.copyfile(srcfile, destfile)
  File "D:\Anaconda3\envs\Keras\lib\shutil.py", line 121, in copyfile
    with open(dst, 'wb') as fdst:
PermissionError: [Errno 13] Permission denied: 'D:\\Anaconda3\\envs\\Keras\\Lib\\site-packages\\numpy\\core\\multiarray.cp35-win_amd64.pyd'

這個問題是一個類似的問題: Tensorflow GPU安裝錯誤Windows 10 Anaconda

但是,我確實確保我的路徑指向正確的位置。

好吧,我已修復它,盡管老實說,我不確定我嘗試過哪種方法。

我再次仔細地執行了步驟。 盡管它可能已經解決了一些先驅問題,但仍然沒有任何效果。 然后,我進入路徑環境變量並開始添加新路徑,以便Tensorflow可以更輕松地在Conda環境中為Keras / Tensorflow查找內容。 特別是,我查找了文件“ pywrap_tensorflow”(找不到的文件)並找到了它,並添加了特定路徑。 我不知道這是否必要。 但最后,它成功了,我現在可以運行tensorflow gpu。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM