模块'tensorflow.python“.u pywrap”“tensorflow”“internal”没有属性“TFE”“NewContextOptions”

2024-10-02 22:26:37 发布

您现在位置:Python中文网/ 问答频道 /正文

我遵循了TensorFlow教程,“Simple Audio Recognition

当我运行train.py时,我收到以下错误消息:

AttributeError                            Traceback (most recent call last)
<ipython-input-4-61266873bc5f> in <module>()
     77 import numpy as np
     78 from six.moves import xrange  # pylint: disable=redefined-builtin
---> 79 import tensorflow as tf
     80 
     81 import input_data

c:\users\jinsu\appdata\local\programs\python\python36\lib\site-packages\tensorflow\__init__.py in <module>()
     22 
     23 # pylint: disable=wildcard-import
---> 24 from tensorflow.python import *
     25 # pylint: enable=wildcard-import
     26 

c:\users\jinsu\appdata\local\programs\python\python36\lib\site-packages\tensorflow\python\__init__.py in <module>()
     47 import numpy as np
     48 
---> 49 from tensorflow.python import pywrap_tensorflow
     50 
     51 # Protocol buffers

c:\users\jinsu\appdata\local\programs\python\python36\lib\site-packages\tensorflow\python\pywrap_tensorflow.py in <module>()
     56     sys.setdlopenflags(_default_dlopen_flags | ctypes.RTLD_LOCAL)
     57 
---> 58   from tensorflow.python.pywrap_tensorflow_internal import *
     59   from tensorflow.python.pywrap_tensorflow_internal import __version__
     60   from tensorflow.python.pywrap_tensorflow_internal import __git_version__

c:\users\jinsu\appdata\local\programs\python\python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py in <module>()
    102 def TFE_NewContextOptions():
    103     return _pywrap_tensorflow_internal.TFE_NewContextOptions()
--> 104 TFE_NewContextOptions = _pywrap_tensorflow_internal.TFE_NewContextOptions
    105 
    106 def TFE_ContextOptionsSetConfig(options, proto, proto_len, status):

AttributeError: module 'tensorflow.python._pywrap_tensorflow_internal' has no attribute 'TFE_NewContextOptions'

所以,我签出了pywrap_tensorflow_internal.pypyhton目录中。
这是pywrap_tensorflow_internal.py中定义TFE_NewContextOptions的部分。在

^{pr2}$

Tags: infrompyimportlocaltensorflowusersappdata