Py学习  »  Python

Python3.7与Tensorflow不兼容?

IggyPass • 5 年前 • 2755 次点击  

我试图继续使用一个Rasa聊天机器人,这是我自9月份以来从未使用过的,我发现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

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/50290
 
2755 次点击  
文章 [ 1 ]  |  最新文章 5 年前
L3viathan
Reply   •   1 楼
L3viathan    6 年前

原因是这一行 pywrap_tensorflow_internal.py :

def TFE_ContextOptionsSetAsync(arg1, async):

从Python3.5开始, async (和 await )是关键字,不能再用作标识符。我想你用的是非常过时的tensorflow版本。