[英]Error with importing tensorflow and tflearn after installing with pip
I have installed tensorflow and tflearn using pip on my windows machine.我已经在我的 Windows 机器上使用 pip 安装了 tensorflow 和 tflearn。 I am using pyhton 3.6 as it was asked by the tutorial because tflearn has some bug with python 3.7.
我正在使用 pyhton 3.6,因为它是教程所要求的,因为 tflearn 对 python 3.7 有一些错误。 I am trying to create a chatbot which reads data from a json fil and while testing my code, I ran into an issue with several exceptions given bellow
我正在尝试创建一个从 json fil 读取数据的聊天机器人,在测试我的代码时,我遇到了一个问题,下面给出了几个例外
when i am trying to run this code当我尝试运行此代码时
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)
I am getting the following error我收到以下错误
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.
Everything is freshly installed, after some issues with installing TensorFLow.在安装 TensorFlow 出现一些问题之后,一切都是全新安装的。 I can't decipher the tracebacks myself, therefore I am hoping some of you guys can help me.
我自己无法破译追溯,因此我希望你们中的一些人可以帮助我。 Thank you in advance!
先感谢您!
It's because tflearn has support for TensorFlow version up to 1.2 only.这是因为 tflearn 仅支持最高 1.2 的 TensorFlow 版本。 You can downgrade your TensorFlow version to use the above code.
您可以降级您的 TensorFlow 版本以使用上述代码。
To downgrade:降级:
pip uninstall protobuf
pip uninstall tensorflow
To install TensorFlow 1.x:要安装 TensorFlow 1.x:
pip install tensorflow==1.15
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.