Install the pip package manager on older versions of Python on Linux, Mac, and Windows that don't come preinstalled with pip.

Subscribe now

Get the highlights in your inbox every week.

Python is a powerful and popular programming language with many packages that are useful for general programming, data science, and many other things. These packages are not included with the Python installation, so you have to download, install, and manage them separately. All of these packages (libraries and frameworks) are stored in a central repository called the Python Package Index, or PyPI for short. This is where pip (short for Preferred Installer Program), Python's package manager, comes into the picture.

Installing Python pip on your system allows you to manage PyPI packages easily. Many of these packages can be installed just by typing python -m pip install <package-name> into a terminal or command-line.

Newer versions of Python 3 (3.4 and higher) and Python 2 (2.7.9 and higher) come preloaded with pip. Older versions of Python didn't include pip, but it can be installed retroactively.

In this article, I explain how to install pip on Linux, Mac, and Windows computers. You can also check the pip.pypa documentation for more information.

Make sure Python is installed

If you don't already have Python installed on your system, do that first; otherwise, the pip installer won't understand any commands. To check whether you have Python, enter python in your command line, Bash, or terminal window and see what happens. If the command is not recognized, then you need to download Python. If you have Python installed, you will see a lot of commands and other stuff that will indicate you can install pip.

Install Python pip on Linux

The command you use to install pip on Linux depends on the distribution you use.

On Fedora, RHEL, and CentOS:

$ sudo dnf install python3

For Debian or Ubuntu, use the Apt package:

$ sudo apt install python3-pip

Other distributions may have their own package manager. For example, Arch Linux uses pacman:

$ sudo pacman -S python-pip

To find out whether pip is installed properly, check the version using the --version option.

That's all you need. You can skip down to the using pip section of this article.

Install Python pip on Mac

MacOS comes with Python installed by default, but the version provided by Apple is almost always outdated, even right an OS release. If you're working with Python, you should use a custom install of Python 3.

Install Python pip on Windows

If you want the same luxuries as Linux users have with a package manager, you can use the Chocolatey package manager for Windows. This provides easy access to Python but also easy updates. You can use it in the open source PowerShell application to make amazing things happen in just a few commands.

PS> choco install python

That's it! You can now use pip to install any package you need.

Using Python pip

Python pip works exactly the same way on each platform: Linux, BSD, Windows, Mac, and so on.

Footer

The opinions expressed on this website are those of each author, not of the author's employer or of Red Hat.

Opensource.com aspires to publish all content under a Creative Commons license but may not be able to do so in all cases. You are responsible for ensuring that you have the necessary permission to reuse any work on this site. Red Hat and the Red Hat logo are trademarks of Red Hat, Inc., registered in the United States and other countries.