vscode设置python多进程调试_python之vscode配置开发调试环境

在vscode中下载python插件,下载量最多的就是

打开launch.json,把以下代码粘贴进去即可

{

// 使用 IntelliSense 了解相关属性。

// 悬停以查看现有属性的描述。

// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387

"version": "0.2.0",

"configurations": [

{

"name": "Python",

"type": "python",

"request": "launch",

"stopOnEntry": false,//是否在第一条语句时程序停止,下面的这个选项都一样

"pythonPath": "D:/Program Files (x86)/Python37-32/python",//设置成自己的python安装路径

"program": "${file}",

"cwd": "${workspaceRoot}",

"env": {},

"envFile": "${workspaceRoot}/.env",

"debugOptions": [

"WaitOnAbnormalExit",

"WaitOnNormalExit",

"RedirectOutput"

]

},

{

"name": "PySpark",

"type": "python",

"request": "launch",

"stopOnEntry": true,

"osx": {

"pythonPath": "${env:SPARK_HOME}/bin/spark-submit"

},

"windows": {

"pythonPath": "${env:SPARK_HOME}/bin/spark-submit.cmd"

},

"linux": {

"pythonPath": "${env:SPARK_HOME}/bin/spark-submit"

},

"program": "${file}",

"cwd": "${workspaceRoot}",

"env": {},

"envFile": "${workspaceRoot}/.env",

"debugOptions": [

"WaitOnAbnormalExit",

"WaitOnNormalExit",

"RedirectOutput"

]

},

{

"name": "Python Module",

"type": "python",

"request": "launch",

"stopOnEntry": false,

"pythonPath": "${config:python.pythonPath}",

"module": "module.name",

"cwd": "${workspaceRoot}",

"env": {},

"envFile": "${workspaceRoot}/.env",

"debugOptions": [

"WaitOnAbnormalExit",

"WaitOnNormalExit",

"RedirectOutput"

]

},

{

"name": "Integrated Terminal/Console",

"type": "python",

"request": "launch",

"stopOnEntry": false,

"pythonPath": "${config:python.pythonPath}",

"program": "${file}",

"cwd": "",

"console": "integratedTerminal",

"env": {},

"envFile": "${workspaceRoot}/.env",

"debugOptions": [

"WaitOnAbnormalExit",

"WaitOnNormalExit"

]

},

{

"name": "External Terminal/Console",

"type": "python",

"request": "launch",

"stopOnEntry": false,

"pythonPath": "${config:python.pythonPath}",

"program": "${file}",

"cwd": "",

"console": "externalTerminal",

"env": {},

"envFile": "${workspaceRoot}/.env",

"debugOptions": [

"WaitOnAbnormalExit",

"WaitOnNormalExit"

]

},

{

"name": "Django",

"type": "python",

"request": "launch",

"stopOnEntry": false,

"pythonPath": "${config:python.pythonPath}",

"program": "${workspaceRoot}/manage.py",

"cwd": "${workspaceRoot}",

"args": [

"runserver",

"--noreload",

"--nothreading"

],

"env": {},

"envFile": "${workspaceRoot}/.env",

"debugOptions": [

"WaitOnAbnormalExit",

"WaitOnNormalExit",

"RedirectOutput",

"DjangoDebugging"

]

},

{

"name": "Flask",

"type": "python",

"request": "launch",

"stopOnEntry": false,

"pythonPath": "${config:python.pythonPath}",

"program": "fully qualified path fo 'flask' executable. Generally located along with python interpreter",

"cwd": "${workspaceRoot}",

"env": {

"FLASK_APP": "${workspaceRoot}/quickstart/app.py"

},

"args": [

"run",

"--no-debugger",

"--no-reload"

],

"envFile": "${workspaceRoot}/.env",

"debugOptions": [

"WaitOnAbnormalExit",

"WaitOnNormalExit",

"RedirectOutput"

]

},

{

"name": "Flask (old)",

"type": "python",

"request": "launch",

"stopOnEntry": false,

"pythonPath": "${config:python.pythonPath}",

"program": "${workspaceRoot}/run.py",

"cwd": "${workspaceRoot}",

"args": [],

"env": {},

"envFile": "${workspaceRoot}/.env",

"debugOptions": [

"WaitOnAbnormalExit",

"WaitOnNormalExit",

"RedirectOutput"

]

},

{

"name": "Pyramid",

"type": "python",

"request": "launch",

"stopOnEntry": true,

"pythonPath": "${config:python.pythonPath}",

"cwd": "${workspaceRoot}",

"env": {},

"envFile": "${workspaceRoot}/.env",

"args": [

"${workspaceRoot}/development.ini"

],

"debugOptions": [

"WaitOnAbnormalExit",

"WaitOnNormalExit",

"RedirectOutput",

"Pyramid"

]

},

{

"name": "Watson",

"type": "python",

"request": "launch",

"stopOnEntry": true,

"pythonPath": "${config:python.pythonPath}",

"program": "${workspaceRoot}/console.py",

"cwd": "${workspaceRoot}",

"args": [

"dev",

"runserver",

"--noreload=True"

],

"env": {},

"envFile": "${workspaceRoot}/.env",

"debugOptions": [

"WaitOnAbnormalExit",

"WaitOnNormalExit",

"RedirectOutput"

]

},

{

"name": "Attach (Remote Debug)",

"type": "python",

"request": "attach",

"localRoot": "${workspaceRoot}",

"remoteRoot": "${workspaceRoot}",

"port": 3000,

"secret": "my_secret",

"host": "localhost"

}

]

}

在settings.json中加上以下代码:

"python.pythonPath": "D:\\Program Files (x86)\\Python37-32\\python" , //自己的python安装路径

"python.linting.enabled": false,

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值