I followed the instructions I found at https://www.edureka.co/community/37544/how-to-run-python-script-in-pycharm-with-sudo-privileges#targetText=Now%20go%20to%20PyCharm%2C%20go,Save%20changes%20and%20exit. to create a python interpreter which had sudo privileges. It works well in the sense that various commands requiring su privilieges work as expected.
But I noticed that every package I added (e.g., pystemd) to the interpreter ended up in /usr/local/..., not in the venv where I expected it would end up. Consequently when I generate a requirements.txt file none of the specially-added packages appear.
I'm obviously doing something wrong (no surprise, I'm new to python & pycharm). Advice and tips appreciated!