使用sudo权限在pyCharm中进行调试? [英] Debugging in pyCharm with sudo privileges?
问题描述
我已经通过运行sudo pycharm.sh
在pyCharm
中测试了需要root访问权限的代码,但这不是我建议的方式.
I've tested code that requires root access in pyCharm
by running sudo pycharm.sh
but this is not the way I would recommend of doing so.
我知道可以通过在pyCharm中将python解释器运行为sudo来使用sudo特权进行调试,但是我们该怎么做?
I know it's possible to debug with sudo privileges by running the python interpreter as sudo in pyCharm but how do we do this?
推荐答案
创建一个执行"sudo python"并转发参数的shell脚本,然后将该脚本配置为PyCharm中的Python解释器.
Create a shell script that does "sudo python" and forwards the arguments, and configure that script as a Python interpreter in PyCharm.
此shell脚本的名称应以python
开头(来源: http://forum.jetbrains.com/message/PyCharm-424-3 ).
Name of this shell script should start with python
(source: http://forum.jetbrains.com/message/PyCharm-424-3).
这篇关于使用sudo权限在pyCharm中进行调试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!