AttributeError:模块“ tensorflow”没有属性“ version”

时间:2019-08-30 21:50:13

标签: tensorflow2.0

有人可以帮忙,为什么我会收到此错误AttributeError: module 'tensorflow' has no attribute 'version'? ver已安装TF2.0.0.rc0

from __future__ import absolute_import, division, print_function, unicode_literals

# TensorFlow and tf.keras
import tensorflow as tf
from tensorflow import keras

# Helper libraries
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt

print(tf.version)

1 个答案:

答案 0 :(得分:1)

enter image description here

您需要将最后一条语句修改为print(tf.__version__)而不是print(tf.version),因为属性名称是__version__而不是版本。