Python modules allow you to use code of others in your code. This saves you a lot of development time, you don’t have to reinvent the wheel each time.
There are two ways to install Python modules: system wide and using a virtual environment.
You may like:
Complete Python Bootcamp: Go from zero to hero in Python
We can create a virtual environemnt, that is seperate from the operating system. This allows you to use the same Python modules as other developers in your team.
Create a virtual environment with the line:
Then open /foo/
You now have 3 directories: bin, include and lib.
Move up a directory.
To activate the virtual environment type:
we can then install any module, any version we want – without affecting the operating system. This way we can have the same version of modules as other developers.
To exit the virtual environment write:
To install a module system wide, use pip and type
That will install a Python module automatically. Generally you do not install modules system wide.