【问题标题】:Syntax error "async" when importing tensorflow in my code在我的代码中导入 tensorflow 时出现语法错误“async”
【发布时间】:2022-11-08 18:38:46
【问题描述】:

当我尝试将 tensorflow 导入我的代码时,会返回此错误:

Python 3.10.5 (v3.10.5:f377153967, Jun  6 2022, 12:36:10) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

\>>> import tensorflow as tf
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/tensorflow/__init__.py", line 24, in <module>
    from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/tensorflow/python/__init__.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 114
    def TFE_ContextOptionsSetAsync(arg1, async):
                                         ^^^^^
SyntaxError: invalid syntax

我的电脑上安装了 tensorflow 和 keras。如何解决此问题以使其正常运行?

【问题讨论】:

标签: python python-3.x tensorflow


【解决方案1】:

我面临同样的问题。我可以知道如何解决吗?

【讨论】:

    猜你喜欢
    • 2018-04-06
    • 2018-09-28
    • 2017-11-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-10-28
    • 2018-08-13
    相关资源
    最近更新 更多