|
|
|
|
|
by nextos
618 days ago
|
|
The right way is to compose the base Python package with the libraries you want. For example, this gives you an ephemeral environment with the latest python3 plus NumPy: nix-shell -p 'python3.withPackages(ps: [ ps.numpy ])'
In case of Python, you can also go for a simpler option that avoids composing Python with its packages, but that gives worse isolation: nix-shell -p python3 python3Packages.numpy
If other packages were present in that ephemeral environment, aside from python3, they could see NumPy in a global directory. That's why the first option is preferable, as it offers better isolation. In Nix, some languages only let you use libraries with something like the first option. See the Nix user wiki for further information: https://nixos.wiki/wiki/Python. |
|