AttributeError:模块"tensorflow"没有属性"Variable""ERROR"; [英] AttributeError: module 'tensorflow' has no attribute 'Variable' "ERROR"

查看:312
本文介绍了AttributeError:模块"tensorflow"没有属性"Variable""ERROR";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用了tensor-flow一天,但是会遇到一些麻烦,当我导入张量流时,会出现AttributeError:'module'对象没有属性'variable'

I have used tensor-flow for ONE day, but there come some troubles, when I import tensor-flow, there would be AttributeError: 'module' object has no attribute 'variable'

我使用Windows10,Python 3.5.3,Anaconda-3 4.4.0

I use Windows10, Python 3.5.3, Anaconda-3 4.4.0

这是我的测试代码:

import tensorflow as tf
my_var = tf.Variable(tf.linspace(10.0, 13.0, 4)) 
with tf.Session() as sess:
    print (sess.run(my_var))

我收到此错误:

推荐答案

似乎您已经编写了一个模块random.py,它掩盖了标准库的

It looks like you have written a module, random.py, which shadows the standard library's random module. Try renaming the file and check if the error goes away. You can tell it's importing your random.py at the bottom of the stacktrace you posted.

这篇关于AttributeError:模块"tensorflow"没有属性"Variable""ERROR";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆