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

Python • Re: Bookworm & Python library hell

$
0
0
Thank you all for your replies. What initially seemed like a big change for working with Python in Bookworm, now seems rather more manageable!

To summarise:

Installing:
Install Python packages with apt where possible:

Code:

sudo apt install python3-packagename
Use a virtual environment where apt packages are not available:

Code:

python -m venv --system-site-packages [path/to/venv][path/to/venv]/bin/python -m pip install packagename
Updating:
Update both system and virtual environment packages

Code:

sudo apt update && sudo apt upgrade[path/to/venv]/bin/python -m pip install --upgrade packagename
Running:
Run Python scripts with:

Code:

[path/to/venv]/bin/python myscript.py
Have I missed anything?

Scripsi
Add, try not to pip install the same or different versions of the system packages into venv, or if you do add a reminder to yourself.

Statistics: Posted by bensimmo — Sat Mar 30, 2024 10:08 pm



Viewing all articles
Browse latest Browse all 3857

Trending Articles