在ubuntu上运行python的代码时候出现错误
FileNotFoundError: [Errno 2] No such file or directory: '/model_pretrained/AOD_net_epoch_relu_10.pth'
尝试了很多方法,把名字重新命名保持和命令行的输入一致,去掉后缀.pth,但是都会出错,最后想着把路径改成绝对路径。结果意外的竟然可以运行!
改的结果如下:
python3 test.py --input_image /home1/Jie/dehaze/AODnet-by-pytorch-master/test/canyon1.jpg --model /home1/Jie/dehaze/AODnet-by-pytorch-master/model_pretrained/AOD_net_epoch_relu_10.pth --output_filename /home1/Jie/dehaze/AODnet-by-pytorch-master/result/canyon1_dehaze.jpg --cuda
原图:

结果图:


本文介绍了一个在Ubuntu系统中运行Python代码遇到的文件未找到错误,并详细记录了解决过程。通过将相对路径改为绝对路径,成功解决了该问题。

被折叠的 条评论
为什么被折叠?



