import os # 当前文件的绝对路径 print(os.path.abspath(__file__)) # 输出:/home/wp/st_detection/download_code/YOLOv5/ultralytics_yolov5_master/train.py # 当前工作目录 print(os.path.abspath('.')) # 输出:/home/wp/st_detection/download_code/YOLOv5 print(os.getcwd()) # 输出:/home/wp/st_detection/download_code/YOLOv5 # 更改当前工作目标 os.chdir('/home/wp/st_detection/download_code/TubeR') print(os.getcwd()) # 输出:/home/wp/st_detection/download_code/TubeR