NFC Raspberry Pi Media Player
Python Virtual Environment Prep
As Carter writes in hisPython Virtual Environment Usage on Raspberry Pi guide:
Starting with the October 10, 2023 Bookworm release of the Raspberry Pi OS, the use of Python Virtual Environments (venv) when pip installing packages is required. No more sudo pip. This will break things and require learning new things. Yeah.
You will need to setup a Python virtual environment (venv) on your Raspberry Pi 5 for this project. Don't worry though! If you follow along with the guide step by step, you'll be just fine.
Always venv
On theOther Ideas page in the venv guide, there is a tip for having the virtual environment enabled automatically at boot by editing the.bashrc
file (sudo nano .bashrc
) and adding this line to the bottom:
Wherevenv
is the name of your virtual environment. You can take this a step further byadding the alias for running Python scripts assudo
to your.bashrc
file as well:
alias gogo='sudo -E env PATH=$PATH python'
alias gogo='sudo -E env PATH=$PATH python'
You can changegogo
to any command you want. This way, every time you boot up your Pi, you'll have your Python venv enabled and you'll be able to use your alias for running Python scripts.
Page last edited November 08, 2024
Text editor powered bytinymce.