The steps below may be shorter but some users find difficulty when applying updates and may run into issues. Before you begin the guide below, ensure that you have a so-called standard build environment that includes things like make, gcc, python3, including Python 3 setuptools and pip modules.

  1. The pip package manager can be used to update one or more packages system-wide. However, if your deployment is located in a virtual environment, you should use the Pipenv package manager to update all Python packages. Python Package Upgrade Checklist. In general, you can use the following steps to perform a package upgrade: 1.
  2. For most Unix systems, you must download and compile the source code. The same source code archive can also be used to build the Windows and Mac versions, and is the starting point for ports to all other platforms. Download the latest Python 3 and Python 2 source.
  3. Visit Python.org and download the latest available Python installer file; Run the downloaded file and install Python 3.x on Mac. Python 3.6.x requires about 100MB of available disk space. The installation process is very fast; When Python 3 is installed, you will see the Python3 folder in.

Pip is a popular command used to manage Python packages. Pip command is also used for updating/upgrading already installed Python packages.

List Installed Python Packages

How To Update Python Mac

Before updating or upgrading an installed Python package we will list already installed packages. We will use the list command which will display the complete name and the version of the installed packages.

Check If A Python Package Is Installed

How To Update Python Mac

In the previous example, we have just listed all installed packages and versions. We can also check if a specific python package is already installed. We will also use grep command by providing the name of the package we want to check.

List Outdated Python Packages

Pip command also provides --outdated options with the list command which will list outdated and already installed python packages.

Upgrade/Update Python Package To The Latest Version

We will use the install command with the --upgrade option and also provide the package name. In this example, we will update/upgrade the package named Django to the latest version. We will also provide the --user option. Alternatively to the --upgrade we can use -U which is the short form.

How To Update Python Macos

How To Update Python Mac

From the screenshot, we see that first the Django version 2.0 is found. Django version 2.0 is uninstalled and then Django version 2.2.5 is installed which will complete the upgrade/update of the Django.

Python

Upgrade/Update Python Package To The Specific Version

In the previous example, we have updated the Django python package to the latest version. We can also update/upgrade a python package into a specific version which is not the latest. In this example, we will upgrade/update a specific version which is not the latest with the equal signs. We will not use the --upgrade option but specify the upgraded version.

We can see that the currently installed version is Django 2.0 but we will upgrade it into version 2.2 .

How To Update Python Mac

Downgrade Python Package To The Specific Version

How To Update Python Version Mac

We can also downgrade the installed package into a specific version. We will specify the Python package name with the version we want to downgrade by using equation signs like below. In this example, we will downgrade the Django package to version 2.0.