【问题标题】:FileNotFoundError: [Errno 2] No such file or directory: although the folder is there, when np.loadFileNotFoundError:[Errno 2] 没有这样的文件或目录:虽然文件夹在那里,当 np.load
【发布时间】:2020-04-03 00:46:42
【问题描述】:

files are there

我在 file.py 中执行 np.save 以保存模型的分数,因此它们有十多个文件 model_1_score.npy、model_2_score.npy、... 在(输出文件夹) 和 np.load 在另一个 file.py 中加载分数的情节 这两个我都试过了,还是不行

res = r'C:\Users\user\Documents\outputs'
res = 'C:\\Users\\user\\Documents\\outputs'

错误信息是

FileNotFoundError: [Errno 2] 没有这样的文件或目录:'C:\Users\user\Documents\outputs/model_1_score.npy'

我该怎么办?请帮忙

【问题讨论】:

  • 您确定文件路径正确且文件存在吗?你能展示一下吗?
  • 是的,我试过 os.getcwd() 它给了我我正在工作的同一个文件目录,文件在那里你可以检查图片

标签: python save


【解决方案1】:

C:\Users\user\Documents\outputs/model_1_score.npy 中的最后一个路径分隔符似乎有误。应该是\,而不是/

【讨论】:

  • 是的,我不知道它是什么样子的。这可能是什么原因??
  • 我无法在这里提供我需要一个电子邮件或不和谐帐户
猜你喜欢
  • 2020-02-03
  • 1970-01-01
  • 1970-01-01
  • 2022-11-13
  • 2019-11-03
  • 2021-08-24
  • 2021-03-07
  • 2015-06-09
  • 2021-04-01
相关资源
最近更新 更多