Python: Difference between revisions
imported>Mudrii m add clarity to python native virtual env |
imported>LuisChDev No edit summary |
||
| Line 14: | Line 14: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
You can put <code>python-with-my-packages</code> into your environment.systemPackages for a system-wide installation, for instance. | You can put <code>python-with-my-packages</code> into your environment.systemPackages for a system-wide installation, for instance. Be mindful that <code>pythonX.withPackages</code> creates a <code>pythonX-Y.Z.W-env</code> package which is read only, so you can't use <code>pip</code> to install packages in, say, a virtual environment (as described below). Put <code>python</code> in your <code>configuration.nix</code> if you want to use the solution as described in the section "Python Virtual Environment". | ||
There are several versions of Python available. Replace <code>python3</code> with <code>python2</code> or <code>pypy</code> in the above snippet according to your needs. | There are several versions of Python available. Replace <code>python3</code> with <code>python2</code> or <code>pypy</code> in the above snippet according to your needs. | ||
| Line 26: | Line 26: | ||
We saw above how to install Python packages using nixpkgs. Since these are written by hand by nixpkgs maintainers, it isn't uncommon for packages you want to be missing or out of date. | We saw above how to install Python packages using nixpkgs. Since these are written by hand by nixpkgs maintainers, it isn't uncommon for packages you want to be missing or out of date. | ||
=== | === Python virtual environment === | ||
Starting from Python 3 virtual environment is natively supported. | Starting from Python 3 virtual environment is natively supported. | ||