tensorflow入门案例MNIST运行示例(softmax模型/CPU)

源代码地址: https://github.com/tensorflow/tensorflow/tree/master/tensorflow/examples/tutorials/mnist

 

运行python ./fully_connected_feed.py

报错1:tensorflow.python.framework.errors_impl.NotFoundError: Failed to create a directory: /tmp\tensorflow; No such file or directory

原因:缺少系统环境变量TEST_TMPDIR

解决方法:添加系统环境变量或定义变量TEST_TMPDIR

 

报错2:TimeoutError: [WinError 10060] 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。

原因:这个问题是无法访问网址,从而无法获取MINST的数据集

解决方法:手动下载下MINST数据集,复制到上面的input_data文件夹中%TEST_TMPDIR%\tensorflow\mnist\input_data

 

路径定义见:mnist_with_summaries.py     

default=os.path.join(os.getenv('TEST_TMPDIR', '/tmp'),
                           'tensorflow/mnist/input_data'),

 

MINST数据集下载地址:http://yann.lecun.com/exdb/mnist/

 

 

再次运行,成功。

tensorflow入门案例MNIST运行示例(softmax模型/CPU)