安装后Tensorflow`语法错误:pywrap_tensorflow` [英] Tensorflow `Syntax Error: pywrap_tensorflow` After Install

查看:37
本文介绍了安装后Tensorflow`语法错误:pywrap_tensorflow`的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经设置了virtualenv并通过 sudo pip3 install使用pip安装了tensorflow --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.10.0-py3-none-any.whl .

I've setup a virtualenv and using pip installed tensorflow via sudo pip3 install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.10.0-py3-none-any.whl.

但是,当我打开python shell测试安装时,出现以下错误:

However, when I open a python shell to test the install I get the following error:

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

我已经搜索了一下,但是找不到一个简单的解决方案.有任何想法吗?谢谢!

I've searched around but can't find a straightforward solution to this. Any ideas? Thanks!

推荐答案

async 是Python 3(

async is a reserved keyword in Python 3 (here's the full list).

看起来您并不是唯一一个遇到此问题的人, tensorflow github问题跟踪器上有一个活动线程可以解决这个问题,该事件可以追溯到7月: https://github.com/tensorflow/tensorflow/issues/20517

Look like you aren't the only one running into this problem, there's an active thread on the tensorflow github issue tracker addressing it that dates back to July: https://github.com/tensorflow/tensorflow/issues/20517

这篇关于安装后Tensorflow`语法错误:pywrap_tensorflow`的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆