tensorflow.python.framework.errors_impl.NotFoundError:无法创建目录:;没有相应的文件和目录

时间:2018-03-01 05:51:30

标签: tensorflow save

是否进行了一些测试来训练一些数据并遇到这样的错误,并想知道什么是“tf_jenkins”文件夹用于?检查我的环境后,我的电脑上确实没有这样的目录,我应该手动创建文件夹还是安装其他插件并自动创建目录。

2018-03-01 02:31:02.958773:WC:\ tf_jenkins \ workspace \ rel-win \ M \ windows \ PY \ 36 \ tensorflow \ core \ framework \ op_kernel.cc:1198]未找到:失败创建一个目录:;没有这样的文件或目录

追踪(最近一次呼叫最后一次):

File "C:\Programs\Python\Python36\lib\site-packages\tensorflow\python\client\session.py", line 1350, in _do_call
    return fn(*args)
  File "C:\Programs\Python\Python36\lib\site-packages\tensorflow\python\client\session.py", line 1329, in _run_fn
    status, run_metadata)
  File "C:\Programs\Python\Python36\lib\site-packages\tensorflow\python\framework\errors_impl.py", line 473, in __exit__
    c_api.TF_GetCode(self.status.status))
tensorflow.python.framework.errors_impl.NotFoundError: Failed to create a directory: ; No such file or directory

在处理上述异常期间,发生了另一个异常:

追踪(最近一次呼叫最后一次):

File "C:\Programs\Python\Python36\lib\site-packages\tensorflow\python\training\saver.py", line 1593, in save
    {self.saver_def.filename_tensor_name: checkpoint_file})
  File "C:\Programs\Python\Python36\lib\site-packages\tensorflow\python\client\session.py", line 895, in run
    run_metadata_ptr)
  File "C:\Programs\Python\Python36\lib\site-packages\tensorflow\python\client\session.py", line 1128, in _run
    feed_dict_tensor, options, run_metadata)
  File "C:\Programs\Python\Python36\lib\site-packages\tensorflow\python\client\session.py", line 1344, in _do_run
    options, run_metadata)
  File "C:\Programs\Python\Python36\lib\site-packages\tensorflow\python\client\session.py", line 1363, in _do_call
    raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.NotFoundError: Failed to create a directory: ; No such file or directory

5 个答案:

答案 0 :(得分:1)

将“ /”更改为“ \\”有助于我修复Windows 10中的错误。

路径错误的示例:

log_dir="logs/fit/" + datetime.datetime.now().strftime("%Y%m%d-%H%M%S")

良好路径示例:

log_dir="logs\\fit\\" + datetime.datetime.now().strftime("%Y%m%d-%H%M%S")

答案 1 :(得分:0)

It will be helpful if you can share how are you trying to execute the program.

But in general following could help:

  • check if all the paths (in your case its probably the checkpoint file your are trying to write) are accessible for program, even in the config if any
  • Also check & remove white spaces in command arguments.

答案 2 :(得分:0)

似乎对“保存”功能的调用没有正确的路径。您应该指定一个保存tensorflow模型的正确路径,如以下示例所示:

saver.save(session, '/tmp/model/', global_step=epoch)

在这种情况下,文件夹“ / tmp / model”必须存在。

答案 3 :(得分:0)

通常情况下,考虑到为linux操作系统编写代码并在Windows上执行代码时,这通常会发生,因为两个操作系统中的目录结构有些不同。例如,如果在python代码中考虑到Linux的路径可能像这样的“ / tmp / output”,那么它将永远不会在Windows中运行,这会给您带来错误。在Windows中,它应该是“ ./tmp/output”或完整路径“ c:/ tmp / output”。 我始终牢记Windows和Linux的操作系统特定代码。 检查是否确定链接enter link description here

答案 4 :(得分:0)

确保在xml文件中文件扩展名存在或不像火车一样     cam_image1.jpg