配置文件内容
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python",
"type": "python",
"request": "launch",
"stopOnEntry": false,
"pythonPath": "C:\\Users\\hetao\\anaconda3\\python.exe",
"program": "${file}",
"cwd": "${workspaceRoot}",
"env": {},
"envFile": "${workspaceRoot}/.env",
"debugOptions": [
"WaitOnAbnormalExit",
"WaitOnNormalExit",
"RedirectOutput"
]
}
]
}
查看python解释器路径
import sys
import os
print('当前 Python 解释器路径:')
print(sys.executable)
r"""
当前 Python 解释器路径:
C:\Users\jpch89\AppData\Local\Programs\Python\Python36\python.EXE
"""
print()
print('当前 Python 解释器目录:')
print(os.path.dirname(sys.executable))
r"""
当前 Python 解释器目录:
C:\Users\jpch89\AppData\Local\Programs\Python\Python36
"""