【发布时间】: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。如何解决此问题以使其正常运行?
【问题讨论】:
-
你是如何安装张量流的?
-
这回答了你的问题了吗? Error in installing Tensorflow in mac
-
请提供代码以便用户重现问题:stackoverflow.com/help/minimal-reproducible-example
标签: python python-3.x tensorflow