首页 > 解决方案 > 我无法读取和打印我的 Json 文件。未能加载原生 TensorFlow 运行时

问题描述

我正在尝试创建一个聊天机器人。我创建了一个 Json 文件,其中包含一些可能的问题和答案。但我正在尝试运行以下 python 代码来加载和打印名为“intents.json”的 Json 文件中的问题和答案。

   mport nltk
   from nltk.stem.lancaster import LancasterStemmer
   stemmer = LancasterStemmer()

   import numpy
   import tflearn
   import tensorflow
   import random
   import json

   #read json file
   with open("intents.json") as file:
   data = json.load(file)

   print(data)

但我遇到以下错误......请我需要你们的帮助:(

PS C:\Users\PRINCE\Documents\SONISOFT\Python Tutors\Python Chat Bot Tutorial\Chat-bot> python main.py             Traceback (most recent call last):
File "C:\Users\PRINCE\anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 64, in <module>
from tensorflow.python._pywrap_tensorflow_internal import *
ImportError: DLL load failed while importing _pywrap_tensorflow_internal: A dynamic link library (DLL) initialization routine failed.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "main.py", line 6, in <module>
import tflearn
File "C:\Users\PRINCE\anaconda3\lib\site-packages\tflearn\__init__.py", line 4, in <module>
import tensorflow.compat.v1 as tf
File "C:\Users\PRINCE\anaconda3\lib\site-packages\tensorflow\__init__.py", line 41, in <module>
from tensorflow.python.tools import module_util as _module_util
File "C:\Users\PRINCE\anaconda3\lib\site-packages\tensorflow\python\__init__.py", line 39, in <module>
from tensorflow.python import pywrap_tensorflow as _pywrap_tensorflow
File "C:\Users\PRINCE\anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 83, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Users\PRINCE\anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 64, in <module>
from tensorflow.python._pywrap_tensorflow_internal import *
ImportError: DLL load failed while importing _pywrap_tensorflow_internal: A dynamic link library (DLL) initialization routine failed.


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

寻求帮助时出现此错误消息。

标签: pythontensorflowchatbotimporterrortflearn

解决方案


推荐阅读