Notes on PIP (Package installer for Python)

By Al McDivitt

Introduction.

pip is the package installer for Python. It is used to install, update, and uninstall various Python packages (libraries). If you plan to code in Python you will find it helpful to know a bit about pip.

Install pip.

Normally if you have installed Python, then pip is installed by default.
Don’t have Python installed? Follow this link to get it. Download Python | Python.org
Note: this article is for windows users, however other operating systems are also catered for.

pip and pip2, pip3.

Which one to use, what’s going on?

I will try to keep this simple, pip versions are relative to the Python version you are using

Python2 and Python3 can both be installed on the same machine at the same time. So you can use pip2 and pip3 respectively.

The simplest way is; if you are using windows 10/11, just install the latest version of Python and use it’s pip.

Use pip install a package (library)

Input> pip install <package-name>

Use a command prompt (with admin permissions) or a PowerShell prompt (again with admin permissions) –

Let’s use a PowerShell prompt first.

As you can see at the prompt I typed > pip install camelcase then pressed the <enter> key.

Note: camelcase is a pip library.

The outcome is camelcase being successfully installed.

Here is the same thing using the command prompt.

Use pip uninstall a package (library)

Input> pip uninstall <package-name>

Use a command prompt (with admin permissions) or a PowerShell prompt (again with admin permissions) –

Let’s use a PowerShell prompt first.

As you can see at the prompt I typed > pip uninstall camelcase then pressed the <enter> key.

Note: camelcase is a pip library.

Note: I was asked if I wanted to Proceed (Y/n)? and I answered y, as I wished to continue with the removing the library. Naturally I could have said “n” to abort removing the library.

The outcome is camelcase being successfully uninstalled.

Here is the same thing using the command prompt.

Use pip Update a package (library)

Input> pip install –upgrade <package-name>

or

Input> pip install -U <package-name>

Use a command prompt (with admin permissions) or a PowerShell prompt (again with admin permissions) –

I’m showing only PowerShell prompt this time.

As you can see at the prompt I typed > pip install –upgrade setuptools then pressed the <enter> key.

The outcome was setuptools package 58.1.0 was upgraded to 62.3.3

Use List to get list of installed packages (libraries)

Input> pip list

At a command prompt (with admin permissions) or a PowerShell prompt (again with admin permissions).

I’m showing only PowerShell prompt this time.

As you can see at the prompt I typed > pip list then pressed the <enter> key.

On this machine I only have two packages installed, pip itself and setuptools.

That’s a wrap

Well, that’s just a quick introduction into pip… a get started and have a play. You may want, or possibly need to learn more. There is plenty of in depth stuff on the web to further your knowledge.

Hope this quick start on pip is of some help and entices you to go further.

Cheer’s Al

Blog – www.iotxplain.com.au/blog/

Web – www.iotxplain.com.au/