使用 PyCharm 终端参数进行调试 [英] Debugging with PyCharm terminal arguments
问题描述
我一直在使用 PyCharm,所以我不是专家.
I have been using PyCharm for a bit so I am not an expert.
我通常在终端上运行程序的方式如下:
How I normally ran my programs was with the terminal like so:
program.py -t input1 -t1 input2
我想知道如何调试它?
对于我写的其他程序,我没有任何参数,所以调试只是设置断点并按下调试.
For other programs I wrote, I did not have any arguments so debugging was simply setting break points and pressing debug.
推荐答案
Menu: Run
-> Edit settings
-> "+" (add new config)
-> Python
.
Menu: Run
-> Edit configurations
-> "+" (add new config)
-> Python
.
脚本名称:program.py
如果您需要从已安装的包中调试脚本,例如 tox
,您也可以指定完整路径.例如:脚本名称:/home/your_user/.envs/env_name/bin/tox
If you need to debug a script from installed packages, such as tox
, you can specify the full path too. For example:
Script name: /home/your_user/.envs/env_name/bin/tox
/home/your_user/.envs/env_name
上方是包含 tox
包的虚拟环境的路径.
Above /home/your_user/.envs/env_name
is a path to virtual environment containing tox
package.
脚本参数:-t input1 -t1 input2
这篇关于使用 PyCharm 终端参数进行调试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!