Skip to main content

Python Pip

PIP is the tool that installs and manages Python packages (you can also think of them as modules).

Note: PIP comes bundled with Python from version 3.4 onward.


What is a Package?

Modules are libraries of Python code that you can add to a project. A package bundles every file a module needs.


Check if PIP is Installed

From the command line, go to Python's script directory and run this command:

main.py
pip --version

Install PIP

Missing PIP? It is available to download and install at this address: https://pypi.org/project/pip/


Download a Package

Getting a package takes very little effort.

All you do is ask PIP for it from the command line: go to Python's script directory and enter the following command:

main.py
pip install camelcase

Using a Package

As soon as the installation finishes, the package is ready for you to use.

Just import "camelcase" into your project.

Example

A short program that imports "camelcase" and uses it:

Prompt
Write a Python program that imports and uses the "camelcase" package. Convert the string "hello world" to camel case using CamelCase().hump().
Output: complete Python program

Find Packages

You can find more packages at https://pypi.org/.


Remove a Package

Removing a package takes the uninstall command:

PIP then asks whether you really want camelcase gone.

Answer with y to finish the removal.

main.py
pip uninstall camelcase

List Packages

To see every package installed on your system, run the list command:

main.py
pip list