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

Python • Re: How to Update cpython

$
0
0
Use pyenv to use your own compiled Python versions, which also allows the direct usage of pip, if the pyenv is active.

But the simplest way is creating a virtual environment and updating pip inside this env.

Code:

python3 -m venv --upgrade-deps --system-site-packages my_env
This creates the directory my_env

--upgrade-deps
Upgrade core dependencies (pip) to the latest version in PyPI

--system-site-packages
Give the virtual environment access to the system site-packages dir.
This is useful, if you are using a package for python which is complicated to compile it, but available in the package repository of Raspberry Pi OS.

Then activate the environment and use python and pip in your terminal.

Code:

source my_env/bin/activate

Statistics: Posted by DeaD_EyE — Tue Sep 02, 2025 8:08 am



Viewing all articles
Browse latest Browse all 8621

Trending Articles