Now, of course, when we're talking about source code,
we are not just talking about C files. No,
of course not. Other scripts such as Python are also going
to be great examples of source code.
It doesn't have to be a language that is going to be compiled.
Now we have Python libraries. And when we're working with the system,
the standard Python system is going to have the libraries that we
need to run Python on our main operating system.
However,
if we start installing Python packages such as Ansible, then we're
going to add additional libraries to the system.
Now this can cause an overhead, so additional libraries that need to be
loaded, but also a library clash where one application needs version one,
another application needs version two of the same library.
We can avoid this problem by working with virtual environments.
Using virtual environments,
we can lighten the system load and avoid the clash of versions
between the requirements of our libraries.
If we want to take a look at installing an application like
Ansible, we can go through and install the python‑3‑virtualenv.
This is working on our Ubuntu system.
This is going to give us the correct modules that we need still
installed into the system by allowing us then to create Python virtual
environments. We can create a directory here.
I'm just creating a directory called Python in my home directory, moving
into that directory, and then creating a virtual environment that I'm
calling Ansible. Within that Ansible directory is going to be our virtual
environment. We can activate it through a script, and we read that script
in using the source command. That will change the path where Python is
pointing to.
We can then go through and use pip3 to install Ansible. This is our Python
installer, and it will be installing the Ansible libraries into our
virtual environment, so we're not overloading the system. We'll also be
able to see that we get the latest version of Ansible that is available
rather than the Ansible that would be available as a package through our
traditional environment.
When we check the version, we'll be able to see that we've got it
installed in the correct location and the latest version. Now these
slides will give you a good overview of what to do and give you a
quick reference, but your real learning is going to be coming from
you doing something,
getting some hands on. So why don't you join me in the lab where we're going to take a look at running through this process?