python-3.x - Python3.7与Tensorflow不兼容?
问题描述
我正在尝试继续使用自 9 月以来我没有使用过的 Rasa 聊天机器人,但我发现 Tensorflow 的依赖存在语法问题。我不知道这是因为我的依赖项需要更新,还是因为我按照 GitHub 上的人的建议使用了 python3.7,或者其他一些原因。
(moo_env) C:\Users\antoi\Documents\Programming\projects\moodbot>py train_online.py
Traceback (most recent call last):
File "train_online.py", line 37, in <module>
nlu_interpreter = RasaNLUInterpreter('./models/nlu/default/moodnlu')
File "C:\Users\antoi\Documents\Programming\projects\moodbot\moo_env\lib\site-packages\rasa_core\interpreter.py", line 221, in __init__
self._load_interpreter()
File "C:\Users\antoi\Documents\Programming\projects\moodbot\moo_env\lib\site-packages\rasa_core\interpreter.py", line 237, in _load_interpreter
self.interpreter = Interpreter.load(self.model_directory)
File "C:\Users\antoi\Documents\Programming\projects\moodbot\moo_env\lib\site-packages\rasa_nlu\model.py", line 276, in load
skip_validation)
File "C:\Users\antoi\Documents\Programming\projects\moodbot\moo_env\lib\site-packages\rasa_nlu\model.py", line 298, in create
components.validate_requirements(model_metadata.component_classes)
File "C:\Users\antoi\Documents\Programming\projects\moodbot\moo_env\lib\site-packages\rasa_nlu\components.py", line 49, in validate_requirements
from rasa_nlu import registry
File "C:\Users\antoi\Documents\Programming\projects\moodbot\moo_env\lib\site-packages\rasa_nlu\registry.py", line 23, in <module>
from rasa_nlu.classifiers.embedding_intent_classifier import \
File "C:\Users\antoi\Documents\Programming\projects\moodbot\moo_env\lib\site-packages\rasa_nlu\classifiers\embedding_intent_classifier.py", line 32, in <module>
import tensorflow as tf
File "C:\Users\antoi\Documents\Programming\projects\moodbot\moo_env\lib\site-packages\tensorflow\__init__.py", line 22, in <module>
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File "C:\Users\antoi\Documents\Programming\projects\moodbot\moo_env\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "C:\Users\antoi\Documents\Programming\projects\moodbot\moo_env\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\antoi\Documents\Programming\projects\moodbot\moo_env\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 114
def TFE_ContextOptionsSetAsync(arg1, async):
SyntaxError: invalid syntax
您可以在Github 存储库中找到我的代码
解决方案
原因是这一行pywrap_tensorflow_internal.py
:
def TFE_ContextOptionsSetAsync(arg1, async):
从 Python 3.5 开始,async
(and await
) 是关键字,不能再用作标识符。我假设您使用的是非常过时的 tensorflow 版本。
推荐阅读
- php - 如何在 Stripe Payment Intent 中修复客户端或服务器端的 3D 安全确认付款?
- c# - 如何取消任务类型集合中的特定任务
- php - 无法连接到命名空间类中的数据库
- jasmine - Protractor - How to assert that the correct option is selected from a droplist
- javascript - Slick Slider Carousel Sync Rows Overlapping (w/ JSFiddle). I'm stumped
- python-3.x - 如何在 Python 数据科学过程中应用模板方法模式,同时不确切知道重复步骤的数量
- python - Spyder IDE - Run file with mpiexec
- python - 是否可以将 TransformedTargetRegressor 添加到 scikit-learn 管道中?
- python - Getting "module 'imaplib' has no attribute 'IMAP4_SSL'" when using imaplib with cx_Freeze
- sql - POSTGRES. error: extra data after last expected column. one double quote?