import tensorflow as tf ... NameError: name 'name' is not defined
今天刚打开pycharm想跑个小demo
万万没想到,给我报个错
看到这个错误,我懵逼了,昨天不特么的还好好的么?
怎么今天就为难 我了 呜呜....
不过机智的没有慌
这应该是强制关机导致的结果
就是说tensorflow某些包丢失了
原因知道了
那么就好办了
conda install tensorflow-gpu
直接重装一下TensorFlow就好了
接下来试试,我们的小程序
# coding:utf-8
import time
import tensorflow as tf
def mian():
a = tf.constant(1)
b = tf.constant(2)
result = a + b
with tf.Session() as sess:
print(sess.run(result))
if __name__ == '__main__':
t_start = time.time()
mian()
print(int(time.time() - t_start), 's')
大功告成!
一般碰到这样的错误 “NameError: name 'name' is not defined”,是该python包的某些文件丢失,所以把这个包重新下载一次就好了!