簡體   English   中英

導入錯誤:Python 3.8 中沒有名為“_pywrap_tensorflow_internal”的模塊

[英]ImportError: No module named '_pywrap_tensorflow_internal' with Python 3.8

我在 Windows 8 上安裝了 Python 3.8 和 TensorFlow 1.12,但是,在編寫此代碼時(注意我沒有使用 Anaconda):

import tensorflow as tf

我收到以下錯誤:

Traceback (most recent call last):
  File "C:\Users\Dany\AppData\Local\Programs\Python\Python38-32\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in swig_import_helper
    fp, pathname, description = imp.find_module('_pywrap_tensorflow_internal', [dirname(__file__)])
  File "C:\Users\Dany\AppData\Local\Programs\Python\Python38-32\lib\imp.py", line 296, in find_module
    raise ImportError(_ERR_MSG.format(name), name=name)
ImportError: No module named '_pywrap_tensorflow_internal'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Dany\AppData\Local\Programs\Python\Python38-32\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "C:\Users\Dany\AppData\Local\Programs\Python\Python38-32\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "C:\Users\Dany\AppData\Local\Programs\Python\Python38-32\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 20, in swig_import_helper
    import _pywrap_tensorflow_internal
ModuleNotFoundError: No module named '_pywrap_tensorflow_internal'


Failed to load the native TensorFlow runtime.

See https://www.tensorflow.org/install/errors

for some common reasons and solutions.  Include the entire stack trace
above this error message when asking for help.
  File "C:\Users\Dany\Desktop\FYP\Python files\NN.py", line 1, in <module>
    import tensorflow as tf

我在 Windows 8 上安裝了 Python 3.8 和 TensorFlow 1.12

這種組合不起作用。 當 tensorflow(即 TF)為 1.12 版本時,不支持 Python 3.8。 它僅在TF (2.2.0rc1,2.2.0rc2 ) 時支持。 請檢查 pypi,沒有可用於 cp38 的文件1.12

如果您正在尋找 TF 1.12 的兼容 python 版本,則為 3.5 到 3.7。 如果您在安裝時遇到任何問題,可能是編譯器有問題,請安裝MSVC 2015 update 3

在此處輸入圖片說明

請參閱CPUGPU 的TF 測試構建配置詳細信息。

如果您對 TF 版本沒有任何顧慮,我建議您安裝 TF 2,它適用於 Windows 8 64 位系統。 在此處參考更多詳細信息。

注意:安裝 TF 2 后,如果您遇到任何 DLL 問題。 可能的情況是

  1. 您需要安裝 MSVC 2019
  2. 你的 CPU/Python 是 32 位的
  3. 您的 CPU 不支持 AVX2 指令
  4. 有一個庫位於不同的位置/未安裝在您的系統上,無法加載。

暫無
暫無

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

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