λ paddle ~ → python
The program ‘python’ is currently not installed...
λ paddle ~ → nix-shell -p 'python3.withPackages(p : [])'
[nix-shell:~]$ python
Python 3.7.2 (default, Dec 24 2018, 03:41:55)
[GCC 7.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'numpy'
>>>
KeyboardInterrupt
>>>
[nix-shell:~]$ ^C
[nix-shell:~]$ exit
λ paddle ~ → nix-shell -p 'python3.withPackages(p : [p.numpy])'
[nix-shell:~]$ python
Python 3.7.2 (default, Dec 24 2018, 03:41:55)
[GCC 7.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>>
KeyboardInterrupt
>>>
[nix-shell:~]$ ^C
[nix-shell:~]$ exit
λ paddle ~ → nix-shell -p 'python2.withPackages(p : [p.numpy])'
these derivations will be built:
/nix/store/4r2lhzcnblj58pbalpw6s0j0q34mrdc3-python-2.7.15-env.drv
building '/nix/store/4r2lhzcnblj58pbalpw6s0j0q34mrdc3-python-2.7.15-env.drv'...
created 686 symlinks in user environment
[nix-shell:~]$ python
Python 2.7.15 (default, Apr 29 2018, 23:18:59)
[GCC 7.4.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>>
KeyboardInterrupt
>>>
[^] # Re: Xkcd
Posté par Guillaum (site web personnel) . En réponse au journal Quelques bonnes pratiques Python pour 2019. Évalué à 3.
Et nix fait déjà ça et gère les packets python.