网上的方法是修改launch.json中的 “cwd” 为 “${fileDirname}” ,亲测无用。
解决方法:修改设置,使终端在py文件当前目录下打开: 1.在设置中搜索teminal,选择用户→python 2.勾选Execute In File Dir