Less than 1 minute
model = torch.load('./checkpoints/new_edge')
FileNotFoundError: [Errno 2] No such file or directory: './checkpoints/new_edge'
当前执行这条import语句的脚本所在的路径 working directory。
影响fopen的文件。 【1】
img_path = '../deepwater.jpg'。working directory必须是在1下learn_python\docs\工程路径\1$ python main.pyimg_path = '工程路径/deepwater.jpg',working directory必须是在docs下learn_python\docs$ python 工程路径/1/main.pyimg_path = os.path.join(sys.argv[0], '../..', r'deepwater.jpg')根据main.py定位, 所以随便working directory.img_path = os.path.join(__file__, '../../../..', r'deepwater.jpg')根据mod2_main.py自身定位, 所以随便working directory.