模块'tensorflow'没有'__version__'成员pylint(无成员)

时间:2020-04-14 20:53:47

标签: python tensorflow visual-studio-code pylint

我刚刚安装了Tensorflow,并尝试打印我安装的版本。

import tensorflow as tf
print(tf.__version__)

当我遇到这个“错误”时:

Module 'tensorflow' has no '__version__' member pylint (no-member)

我说错误是因为它将2.0.0打印到终端,但是VSCode仍然说文件中有错误。我认为这可能与短绒棉有关,但是我已经安装了TF recommends。{p}

关于如何解决此错误的任何想法?在添加参数以禁用此类错误之前,我更想知道是什么原因造成的。

1 个答案:

答案 0 :(得分:1)

看起来像我检查版本不正确的方式。取a look at the docs应该是:

import tensorflow as tf
print(tf.version.VERSION)