venv
This is an old revision of the document!
The aim of virtualenv is to provide your own instance of Python as maintaining different versions of packages is really tricky. This tutorial shows how to have a tailored Python environement for your program :
You can create a directory for your program
nicolas.greneche@magi1:~$ mkdir mon_programme nicolas.greneche@magi1:~$ cd mon_programme
Ensuite tu crée un virtualenv basé sur le python de magi :
nicolas.greneche@magi1:~$ virtualenv -p /usr/bin/python3.7 venv
Tu actives :
nicolas.greneche@magi1:~$ source venv/bin/activate
Comme tu peux le voir, ton nouvel interpreteur python est celui du virtualenv :
(venv) nicolas.greneche@magi1:~/mon_programme$ which python
/nfs/homes/nicolas.greneche/mon_programme/venv/bin/python
Et enfin tu peux installer les packages de ton choix :
(venv) nicolas.greneche@magi1:~/mon_programme$ pip install numpy
venv.1637182452.txt.gz · Last modified: 2021/11/17 21:54 by nico