成功解决FileNotFoundError: [Errno 2] No such file or directory: '/home/bai/Myprojects/Tfexamples/data/kn

简介: 成功解决FileNotFoundError: [Errno 2] No such file or directory: '/home/bai/Myprojects/Tfexamples/data/kn

解决问题


FileNotFoundError: [Errno 2] No such file or directory: '/home/bai/Myprojects/Tfexamples/data/knifey-spoony\\knifey\\knifey-02-0219.jpg'





解决思路


找不到文件错误

出现该情况,要么是不存在该文件,要么是该文件路径不对!




解决方法


经过分析,发现原因是加载文件路径不对!


新加文件的相对路径代码即可!


self.in_dir= 'data/name'   #新加代码 190814



哈哈,大功告成!


 


相关文章
|
Docker Python 容器
解决docker FileNotFoundError: [Errno 2] No such file or directory: ‘./data/train
解决docker FileNotFoundError: [Errno 2] No such file or directory: ‘./data/train
578 0
成功解决OSError: Unable to open file (truncated file: eof = 8388608, sblock->base_addr = 0, stored_eof =
成功解决OSError: Unable to open file (truncated file: eof = 8388608, sblock->base_addr = 0, stored_eof =
成功解决OSError: Unable to open file (truncated file: eof = 8388608, sblock->base_addr = 0, stored_eof =
|
7月前
|
Shell
adb: error: cannot create file/directory ‘d:/1.png‘: No such file or directory
adb: error: cannot create file/directory ‘d:/1.png‘: No such file or directory
126 0
|
Python
ERROR: file or directory not found: xx.py
​ 1、问题出现原因 在vscode中已导入pytest框架,做自动化demo小测试,运行Python文件一直出现如题错误,截图如下: ERROR: file or directory not found: xx.py  2、解决办法 1)直接把该文件移到当前主目录下,放在PYTHON-STUDY下 2)VSCode中右键tuopan.py文件,选择[在集成终端中打开],或者通过CD命令进入到tuopan.py文件所在目录 然后输入以下命令即可: 注:上述命令不是换行,在d:/前有空格 ,第一行信息为python所在安装路径,空格后的换行为运行的python文件的所在路径  
173 0
ftok info: No such file or directory
ftok info: No such file or directory
230 0
objdump: ‘1443.14.0)‘: No such file or directory
objdump: ‘1443.14.0)‘: No such file or directory
112 0
error: ac_nonexistent.h: No such file or directory
error: ac_nonexistent.h: No such file or directory
584 0
Cannot open include file: 'unistd.h': No such file or directory的解决办法
Cannot open include file: 'unistd.h': No such file or directory的解决办法
395 0
No such file or directory
No such file or directory
324 0
No such file or directory
|
Python
FileNotFoundError: [Errno 2] No such file or directory
FileNotFoundError: [Errno 2] No such file or directory
744 0
FileNotFoundError: [Errno 2] No such file or directory