Python3.7与Tensorflow不兼容吗?

时间:2019-01-07 13:49:04

标签: python-3.x tensorflow rasa-nlu rasa-core

我试图继续使用9月份以来从未使用过的Rasa聊天机器人,但发现Tensorflow依赖项存在语法问题。我不知道这是由于存在updates to be made with my dependencies还是due to the fact that I use python3.7 as suggested by people on GitHub还是其他原因。

(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 repository

中找到我的代码

1 个答案:

答案 0 :(得分:0)

原因是pywrap_tensorflow_internal.py中的这一行:

def TFE_ContextOptionsSetAsync(arg1, async):

自从Python 3.5起,async(和await)是关键字,不能再用作标识符。我假设您使用的是过时的tensorflow版本。