You can use nix-shell
to quickly start shells with different versions of Python and Python packages availabl. nix-shell
will make sure the referred packages are made available (built or downloaded) in the /nix/store
, and start a shell with environment variables like PYTHONPATH
set appropriately. For example:
nix-shell -p python27Packages.numpy
In the shell started by nix-shell
, check the versions:
- run
python --version
- run
python
- type
import numpy; numpy.__version__
Ctrl+D
to exit python
- type
Ctrl+D
to exitnix-shell
.
nix-shell -p python36Packages.numpy
Check the versions as above.