问题遇到的现象和发生背景
vscode 使用python进行绝对导入 失败,尝试了好久,不知道哪里有问题。明明cmd目前目录在根目录,但是执行的时候还是找不到根目录
操作环境、软件版本等信息
下面是vscode我目前的setting.json
{
"editor.formatOnType": true,
"editor.formatOnSave": true,
"files.autoSave": "afterDelay",
"workbench.editorAssociations": {
"*.ipynb": "jupyter-notebook"
},
"notebook.cellToolbarLocation": {
"default": "right",
"jupyter-notebook": "left"
},
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"[python]": {
"editor.wordBasedSuggestions": false
},
"python.autoComplete.extraPaths": [],
"python.analysis.extraPaths": [],
"security.workspace.trust.untrustedFiles": "open",
"workbench.startupEditor": "none",
"[jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
// "terminal.integrated.shell.windows":"C:\\Windows\\System32\\cmd.exe",
// "terminal.integrated.shell.windows":"C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
"terminal.integrated.profiles.windows": {
"Git-Bash": {
"path": "C:\\program files\\Git\\bin\\bash.exe",
"args": [],
"icon": "terminal-bash"
}
},
"terminal.integrated.defaultProfile.windows": "Git-Bash"
// "terminal.integrated.automationProfile.windows": {
// }
// "terminal.integrated.env.osx": {
// "PYTHONPATH": "${workspaceFolder}",
// },
// "terminal.integrated.env.linux": {
// "PYTHONPATH": "${workspaceFolder}",
// },
// "terminal.integrated.env.windows": {
// "PYTHONPATH": "${workspaceFolder}",
// },
// "code-runner.runInTerminal": true,
// "python.terminal.executeInFileDir": true,
// "workbench.editorAssociations": [
// {
// "viewType": "jupyter.notebook.ipynb",
// "filenamePattern": "*.ipynb"
// }
// ]
}
我想要达到的结果
想要设置根目录。