python 有关路径实验
下一级目录
这说明 ./utils
和.\utils
和utils
三个写法的作用都是一样的
(pytorch_gpu) PS F:\python\Deep-Learning-Image-Classification-Models-Based-CNN-or-Attention-main> python /utils/train.py
D:\anaconda\envs\pytorch_gpu\python.exe: can't open file 'F:\\utils\\train.py': [Errno 2] No such file or directory
这里说明/
在根目录(F盘)下面找utils了
验证:
(pytorch_gpu) PS F:\python\Deep-Learning-Image-Classification-Models-Based-CNN-or-Attention-main\utils> python /utils/test.py
D:\anaconda\envs\pytorch_gpu\python.exe: can't open file 'F:\\utils\\test.py': [Errno 2] No such file or directory
当我再进入下一级目录,然后再使用python /utils/test.py
。他找的还是F盘下面的util
上一级目录
(pytorch_gpu) PS F:\python\Deep-Learning-Image-Classification-Models-Based-CNN-or-Attention-main\utils> python ../results/x.py
D:\anaconda\envs\pytorch_gpu\python.exe: can't open file 'F:\\python\\Deep-Learning-Image-Classification-Models-Based-CNN-or-Attention-main\\results\\x.py': [Errno 2] No such file or directory
(pytorch_gpu) PS F:\python\Deep-Learning-Image-Classification-Models-Based-CNN-or-Attention-main\utils> python ..\results/x.py
D:\anaconda\envs\pytorch_gpu\python.exe: can't open file 'F:\\python\\Deep-Learning-Image-Classification-Models-Based-CNN-or-Attention-main\\results\\x.py': [Errno 2] No such file or directory
说明../
和..\
的作用是一样的