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 “mon_programme” :
nicolas.greneche@magi1:~$ mkdir mon_programme nicolas.greneche@magi1:~$ cd mon_programme
Then, you can create a virtualenv based mon Magi's Python in a subdirectory called “venv” :
nicolas.greneche@magi1:~$ virtualenv -p /usr/bin/python3.7 venv
You may activate the brand new environement :
nicolas.greneche@magi1:~$ source venv/bin/activate
You can check that your default Python is from the virtualenv :
(venv) nicolas.greneche@magi1:~/mon_programme$ which python /nfs/homes/nicolas.greneche/mon_programme/venv/bin/python
Finally, you can install your own packages in the virtualenv :
(venv) nicolas.greneche@magi1:~/mon_programme$ pip install numpy
venv.1637182660.txt.gz · Last modified: 2021/11/17 21:57 by nico