我正在使用tensorflow 1.0.0,我想访问tensorflow.layers模块。该模块似乎存在:
In [12]: dir(tensorflow.layers)
Out[12]:
['__builtins__',
'__doc__',
'__file__',
'__name__',
'__package__',
'_allowed_symbols',
'average_pooling1d',
'average_pooling2d',
'average_pooling3d',
'batch_normalization',
'conv1d',
'conv2d',
'conv2d_transpose',
'conv3d',
'dense',
'dropout',
'max_pooling1d',
'max_pooling2d',
'max_pooling3d',
'separable_conv2d']
但是当我尝试导入时,例如密集的功能:
In [13]: from tensorflow.layers import dense
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-13-e5b2c910300d> in <module>()
----> 1 from tensorflow.layers import dense
ImportError: No module named layers
为什么python不能访问该模块?
答案 0 :(得分:1)
您的安装或工作区出现问题:
pip install —upgrade —ignore-installed tensorflow)
print(tensorflow.__version__)