1

我只是在学习“TensorFlow Mechanics 101”。当我运行 fully_connected_feed.py 来训练 MNIST 数据时发生错误:

Step 1800: loss = 0.30 (0.002 sec)
Step 1900: loss = 0.44 (0.003 sec)
Training Data Eval:
  Num examples: 55000  Num correct: 49180  Precision @ 1: 0.8942
Validation Data Eval:
  Num examples: 5000  Num correct: 4509  Precision @ 1: 0.9018
Test Data Eval:
  Num examples: 10000  Num correct: 9023  Precision @ 1: 0.9023
An exception has occurred, use %tb to see the full traceback.

SystemExit

D:\software\anaconda\envs\tensorflow\lib\site-packages\IPython\core\interactiveshell.py:2870: 
UserWarning: To exit: use 'exit', 'quit', or Ctrl-D.
  warn("To exit: use 'exit', 'quit', or Ctrl-D.", stacklevel=1)

在我输入 '%tb' 后,它显示:

%tb
Traceback (most recent call last):

  File "<ipython-input-1-984b11309266>", line 1, in <module>
    runfile('D:/wangjc/pythonTest/TensorFlow/testTensorFlow.py', wdir='D:/wangjc/pythonTest/TensorFlow')

  File "D:\software\anaconda\envs\tensorflow\lib\site-packages\spyder\utils\site\sitecustomize.py", line 707, in runfile
    execfile(filename, namespace)

  File "D:\software\anaconda\envs\tensorflow\lib\site-packages\spyder\utils\site\sitecustomize.py", line 101, in execfile
    exec(compile(f.read(), filename, 'exec'), namespace)

  File "D:/wangjc/pythonTest/TensorFlow/testTensorFlow.py", line 277, in <module>
    tf.app.run(main=main, argv=[sys.argv[0]] + unparsed)

  File "D:\software\anaconda\envs\tensorflow\lib\site-packages\tensorflow\python\platform\app.py", line 48, in run
    _sys.exit(main(_sys.argv[:1] + flags_passthrough))

SystemExit

我发现了一个像我这样的问题,但实际上它与我的问题不同。此错误消息显示与我不同:

TypeError: run() got an unexpected keyword argument 'argv'

另外,我通过“pip install”安装了 TensorFlow 1.1.0。

而且,我尝试在不同的 TensorFlow 版本中使用几种“fully_connected_feed.py”代码,但会出现其他错误(如果使用较低版本)或相同的错误。

有人说出现“SystemExit”错误是因为存在 CMD 线程问题。但我不知道它是否是根以及它在哪里。

请帮我解决这个问题。谢谢!

我的ide环境是:

  1. 窗户 10
  2. 蟒蛇 Python 3.5
  3. TensorFlow 1.1.0
  4. TensorFlow 是通过以下代码安装的: (tensorflow) wangjc@wangjc-Inspiron-3668:~$ pip install --ignore-installed --upgrade https://xxxxxxxx.whl

版本如下图:

import tensorflow as tf

tf.VERSION
Out[4]: '1.1.0'
4

1 回答 1

1

从您的回溯中:

_sys.exit(main(_sys.argv[:1] + flags_passthrough))

对 main 的调用包含在一个_sys.exit()调用中,该调用在程序完成后终止退出程序。您收到的消息来自在 iPython 迭代 shell 中运行文件。sys.exit()引发SystemExit通常用于退出 python 的异常。然而,iPython 的 shell 会捕获该异常并向您显示一个警告。但是,这不会影响您的程序。只需忽略该消息或删除脚本中_sys.exit()对调用的包装即可。main()

于 2017-09-12T10:25:23.130 回答