Python: Difference between revisions
Tag: Undo |
Add note about system-level packages in NixOS |
||
| Line 30: | Line 30: | ||
Once you have picked the Python packages you want, run <code>nix-shell</code> (or <code>nix develop -f shell.nix</code>) to build the Python environment and enter it. Once in the environment Python will be available in your PATH, so you can run eg. <code>python --version</code>. | Once you have picked the Python packages you want, run <code>nix-shell</code> (or <code>nix develop -f shell.nix</code>) to build the Python environment and enter it. Once in the environment Python will be available in your PATH, so you can run eg. <code>python --version</code>. | ||
Note that with NixOS, this method can be used to install packages at the system level, e.g. <syntaxhighlight lang="nix"> | |||
environment.systemPackages = with pkgs; [ | |||
# ... | |||
(python3.withPackages (python-pkgs: with python-pkgs; [ | |||
pandas | |||
requests | |||
])) | |||
]; | |||
</syntaxhighlight> | |||
==== Using a Python package not in Nixpkgs ==== | ==== Using a Python package not in Nixpkgs ==== | ||