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

时间:2024-11-19 19:05:02

环境: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.****.net/forestlinzi0059/article/details/79016700