Having virtual environments in Python can be very interesting to isolate projects from each other. For example, we can have a different version of a certain library for each project. Additionally, it provides greater security when updating the operating system since the virtual environment libraries will not depend on those of the operating system.
We install support for virtual environments in Python:
We create a virtual environment called ENV:
New python executable in /home/kr0m/ENV/bin/python2.7
Also creating executable in /home/kr0m/ENV/bin/python
Installing setuptools, pip, wheel...done.
In Python3:
We load the virtualEnv:
(ENV) RX4 ✺ ~>
Now we can install the libraries we need through the virtualEnv pip, and they will be completely isolated from our OS.
We can check the installed libraries using pip both outside and inside the virtual environment:
tahoe-lafs 1.12.1
To exit the virtual environment:
RX4 ✺ ~>
If we want a script to run directly within our virtual environment, we must indicate the interpreter:
#! /path/to/ENV/bin/python