Comment

Comment by whalesalad

every project you have should be in a virtual environment. it is not hard. https://docs.python.org/3.12/library/venv.html

    python -m venv ~/my-venvs/<name>

    source ~/my-venvs/name/bin/activate

    pip install <package>
but stuff like this would usually get installed globally, and your projects would instead have a venv.

personally my favorite tool is pyenv, which allows you to have many versions of python on your machine as well as many virtualenv (which are assigned to any version you have installed)

then it is as simple as

    pyenv virtualenv <version> <name>
    pyenv virtualenv 3.11.1 xyz
and to activate

    pyenv activate xyz
this allows you to keep every project you have isolated not only to the packages required to run it, but also the python version required.

I work on a handful of projects that run on 3.10, 3.11 and 3.12. Each has their own independent python version, and within that version they also have their own python packages (pip environment).

At the end of the day these are simply directories on disk.

parent whalesalad 2 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton