Movatterモバイル変換


[0]ホーム

URL:


Skip to main content
Adafruit Logo
0
NFC Raspberry Pi Media Player Python Virtual Environment Prep

NFC Raspberry Pi Media Player

published November 08, 2024, last edited February 28, 2025
Save Link Note Download
34
Intermediate
Project guide
😍1
🔥1

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.

Python Virtual Environment Usage on Raspberry Pi
By Carter Nelson
View Guide

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:

source home/user/venv/bin/activate
source home/user/venv/bin/activate

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.

raspberry_pi_20241105_10h41m03s_grim.jpg

Page last edited November 08, 2024

Text editor powered bytinymce.

Related Guides
Search

Search

Categories

[8]ページ先頭

©2009-2025 Movatter.jp