make sudo python ( for pycharm debug) - Serbipunk/notes GitHub Wiki
https://esmithy.net/2015/05/05/rundebug-as-root-in-pycharm/
sudo visudo -f /etc/sudoers.d/python
Add a line of the form:
<user> <host> = (root) NOPASSWD: <full path to python>
For example:
eric V-LU-ERSM = (root) NOPASSWD: /home/eric/Envs/my-project/bin/python
Call the script python-sudo.sh, containing (with your correct full python path):
#!/bin/bash
sudo /home/eric/Envs/my-project/bin/python "$@"
Be sure to make the script executable:
chmod +x python-sudo.sh