我已经设置了virtualenv并使用了sudo pip3 install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.10.0-py3-none-any.whl
通过pip安装的tensorflow。
但是,当我打开python shell测试安装时,出现以下错误:
Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 26 2018, 23:26:24)
[Clang 6.0 (clang-600.0.57)] 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 "/Users/joshuablew/Projects/Environments/proj1/lib/python3.7/site-packages/tensorflow/__init__.py", line 22, in <module>
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File "/Users/joshuablew/Projects/Environments/proj1/lib/python3.7/site-packages/tensorflow/python/__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "/Users/joshuablew/Projects/Environments/proj1/lib/python3.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/Users/joshuablew/Projects/Environments/proj1/lib/python3.7/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 114
def TFE_ContextOptionsSetAsync(arg1, async):
^
SyntaxError: invalid syntax
我已经搜索了一下,但是找不到一个简单的解决方案。有任何想法吗?谢谢!
答案 0 :(得分:1)
async
是Python 3(here's the full list)的保留关键字。
看起来您并不是唯一一个遇到此问题的人,tensorflow
github问题跟踪器上有一个活动的线程可以解决这个问题,它可以追溯到7月:https://github.com/tensorflow/tensorflow/issues/20517