Difficulty: beginner
Estimated Time: 15 minutes

This module will be focused on the pip package manager, in addition to some useful third-party Python modules to start looking at.

Well done!

Don’t stop now! The next scenario will only take about 10 minutes to complete.

F5CA Python 002 Lesson 4 - pip and Some Useful Modules

Step 1 of 4

Practicing with pip

Installing pip

apt update
apt install python3-pip
Confirm it works: pip3

Using pip

Go ahead and use pip to install Flask, which is a really awesome (in my opinion) Python micro web framework.

pip3 install Flask

Notice how it installs dependencies like Jinja (a templating engine).

Requirements

You can use pip to install specific third-party requirements for your application. To do this:

touch requirements.txt
vim or emacs into requirements.txt
Add this line:
python-dateutil==2.6.0
Save the file
pip3 install -r requirements.txt 
pip3 freeze

Notice how it installed python-dateutil version 2.6.0, which is less than the latest version on PyPi, 2.6.1.

A reminder how to use packages (well, you'll need to read their documentation to understand functionality, but here is an example of this particular one):

python3
from dateutil.easter import *
print(easter(2018))