tf.app.run() 运行结束时,报错:SystemExit exception: no description

环境:Python3.6.6 + tensorflow-gpu

源码如下:

import tensorflow as tf

def main():
    print("hello tf.app.run")

if __name__ == '__main__':
    tf.app.run()

运行完后,提示

Exception has occurred: SystemExit
exception: no description
File "/home/work/Downloads/SSD-Tensorflow/test.py", line 10, in <module> tf.app.run()

改为直接调用main()函数,就好了。

import tensorflow as tf

def main():
    print("hello tf.app.run")

if __name__ == '__main__':
    main()

即便不改,程序结果也是正确的。

参考了:https://blog.csdn.net/forestlinzi0059/article/details/79016700

猜你喜欢

转载自www.cnblogs.com/xbit/p/10031349.html