Pip is a package manager for Python. You can use it to install modules. Sometimes systems have two versions of pip in the store, you need version 3 (the newest).

A module is code: in the form of functions or objects. You can include this in your program and build upon it. You could see this as premade parts that you use build your project with.

PyPI is the Python package index, where all the official modules for Python are stored.

Related course: Complete Python Programming Course & Exercises

Pip

Install pip

Installation of pip is easy. You can install it with the system package manager. If you use Linux it’s often already installed.

On Linux you can install it with:

1
2
3
4
5
# debian and ubuntu linux
sudo apt-get install python3-pip

# fedora linux
sudo yum install python3-pip

On Mac OS X, install it with easy_install.

1
sudo easy install pip

Install module

Is pip installed? It can install packages from the PyPi repository. It’s the official repository for python modules.

Software you install with pip is downloaded from the PyPi repo and installed.

To install a module, simply type:

1
pip install modulename

This could be any module from the PiPy index, lets take playsound:

1
pip install playsound

Virtualenv

You’d always want to install inside a virtual environment and not globally on your system.

Virtualenv creates an isolated environment, so packages you install won’t affect other python projects. You can do that in this way:

1
2
3
virtualenv name
cd name
source bin/activate

Then your environment is active and you can install modules with pip,

1
pip install package

If you want to end working with the project type deactivate.

If you are a beginner, then I highly recommend this book.

You can find packages in the PyPi index either online or in the command line.
To search in the command line type the command below, where topic is the word you want to search for.

1
pip search topic

This will show a list of available software modules.

Download examples and exercises