1 问题描述

>>> import tensorflow as tf
>>> tf._version_
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'tensorflow' has no attribute '_version_'

明明已经安装成功了为什么连版本号属性都没有呢?

2 解决方案——或许是引用错误

经检查发现,引用属性时候应该是

>>> import tensorflow as tf
>>> tf.__version__

单独看不明显,现在看图片:

3 解决方案——或许是tensorflow版本不对

应该重新安装一下tensorflow的版本。

pip uninstall tensorflow
pip install --upgrade --ignore-installed tensorflow

先卸载已有的tensorflow版本,再重新安装。

亲测可用。

Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐