Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 1575

Python • Re: Help with running script in both sudo and venv

$
0
0
I've done hacky ugly things to get stuff like this working

Code:

cd path/to/projectif [ ! -d "./venv" ]; then        sudo -H -u pi python3 -m venv venvfisource ./venv/bin/activatesudo chown -R pi:pi /home/pi/.cacheif ! sudo -H -u pi ./venv/bin/pip list |& grep -iq 'tk'; then        sudo chown -R pi:pi /home/pi/.cache        sudo -H -u pi ./venv/bin/pip install tk --upgradefipython3 app.py
might help you, not best practice I imagine :D

Statistics: Posted by wcl55 — Mon Nov 17, 2025 4:17 pm



Viewing all articles
Browse latest Browse all 1575

Trending Articles