簡體   English   中英

如何修復“無法加載本機 TensorFlow 運行時”錯誤

[英]How to Fix "Failed to load the native TensorFlow runtime" Error

我正在嘗試使用 Powershell 從記事本中的文件運行我為 Tensorflow 編寫的程序。 每當我運行python main.py打開並執行代碼時,都會出現以下錯誤。

我真的沒有找到任何可以嘗試的東西,我覺得我唯一能做的就是卸載並重新安裝 Tensorflow,但這不起作用。

C:\Users\stxrsstillfade> cd tensorflow-demo
C:\Users\stxrsstillfade\tensorflow-demo> python main.py

代碼錯誤甚至與代碼無關。 回溯說問題出在第一行import tensorflow

Traceback (most recent call last):
  File "main.py", line 1, in <module>
    import tensorflow as tf
  File "C:\Python27\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
    from tensorflow.python import *
  File "C:\Python27\lib\site-packages\tensorflow\python\__init__.py", line 72, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\tensorflow\python\__init__.py", line 66, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "C:\Python27\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 28, in <module>
    _pywrap_tensorflow = swig_import_helper()
  File "C:\Python27\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 20, in swig_import_helper
    import _pywrap_tensorflow
ImportError: No module named _pywrap_tensorflow


Failed to load the native TensorFlow runtime.

See https://github.com/tensorflow/tensorflow/blob/master/tensorflow/g3doc/get_started/os_setup.md#import_error

for some common reasons and solutions.  Include the entire stack trace
above this error message when asking for help.

我嘗試訪問 GitHub 鏈接,但它似乎已被刪除。

提前感謝您的回答。

請按照TensorFlow 網站的說明進行操作。 如果您使用較低版本,我建議請安裝 Tensorflow 2

要修復Failed to load the native TensorFlow runtime ,您需要從此處下載並安裝/更新 Microsoft Visual C++ 2015-2019 Redistributable (x64)。

如果您面臨任何其他問題,可能的原因是

  • 您的 CPU 不支持 AVX2 指令
  • 你的 CPU/Python 是 32 位的
  • 有一個庫位於不同的位置/未安裝在您的系統上,無法加載。

請參考 Windows CPUGPU 的測試構建配置。

暫無
暫無

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

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