Nix vs pyenv

Jan 28, 2026

There is no need to use pyenv for Python development (if you have Nix installed).

Create a temporary shell with python 3.12 (or the version you want).

nix shell nixpkgs#python312

Create and activate Python virtual environment.

python -m venv .venv
. .venv/bin/activate

The directory .venv/bin will contain the pip executable and symlinks to the python interpreter.

ls -l .venv/bin

You will see that the .venv/bin/python symlink points at a path under /nix/store/. This means that each time we will activate the virtual env, we will refer to that python interpreter, even without running nix shell.