[英]Error with importing tensorflow and tflearn after installing with pip
我已经在我的 Windows 机器上使用 pip 安装了 tensorflow 和 tflearn。 我正在使用 pyhton 3.6,因为它是教程所要求的,因为 tflearn 对 python 3.7 有一些错误。 我正在尝试创建一个从 json fil 读取数据的聊天机器人,在测试我的代码时,我遇到了一个问题,下面给出了几个例外
当我尝试运行此代码时
import nltk
from nltk.stem.lancaster import LancasterStemmer
stemer = LancasterStemmer()
import numpy
import tflearn
import tensorflow
import random
import json
with open("intents.json") as file:
data = json.load(file)
print(data)
我收到以下错误
Traceback (most recent call last):
File "c:\Users\win 10\Desktop\chatbot\index.py", line 6, in <module>
import tflearn
File "C:\Users\win 10\AppData\Local\Programs\Python\Python36\lib\site-packages\tflearn\__init__.py", line 4, in <module>
from . import config
File "C:\Users\win 10\AppData\Local\Programs\Python\Python36\lib\site-packages\tflearn\config.py", line 3, in <module>
import tensorflow as tf
File "C:\Users\win 10\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
from tensorflow.python import *
File "C:\Users\win 10\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\__init__.py", line 52, in <module>
from tensorflow.core.framework.graph_pb2 import *
File "C:\Users\win 10\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\core\framework\graph_pb2.py", line 6, in <module>
from google.protobuf import descriptor as _descriptor
File "C:\Users\win 10\AppData\Local\Programs\Python\Python36\lib\site-packages\google\protobuf\descriptor.py", line 47, in <module>
from google.protobuf.pyext import _message
ImportError: DLL load failed: The specified procedure could not be found.
在安装 TensorFlow 出现一些问题之后,一切都是全新安装的。 我自己无法破译追溯,因此我希望你们中的一些人可以帮助我。 先感谢您!
这是因为 tflearn 仅支持最高 1.2 的 TensorFlow 版本。 您可以降级您的 TensorFlow 版本以使用上述代码。
降级:
pip uninstall protobuf
pip uninstall tensorflow
要安装 TensorFlow 1.x:
pip install tensorflow==1.15
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.