How To Update Python Mac



MacHow To Update Python Mac

Learn how to upgrade Python 3.6 to Python 3.7 or 3.8 on Mac OS.

1) Open up Python official download site. It looks something like the image below. Press Download Python 3.7.4or the version you would like to download. 2) Use the download installer to install Python 3.7. 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. To update python run brew update in the Terminal (this will update Homebrew) and then brew upgrade python3 if a new version of python3 is found by the command brew update; at the end you can run brew cleanup python3 to remove every old version; with this fancy package manager, you can also take care of R.

Python Official Site

1) Open up Python official download site. It looks something like the image below. Press Download Python 3.7.4(release date was July 8, 2019) or Download Python 3.8.0(release date was Oct. 14, 2019) or the version you would like to download.

2) Use the download installer to install Python 3.7. You can refer to How to Install Python3 article for more information.

Homebrew

If you use Homebrew, you can run brew install command to update Python to Python 3.7

Verification

How To Update Python Mac

After you install, python3 command will point to Python 3.7. You can verify by using commands below.

You can use which command to find out the location of Python 3.7

Note

How To Update Python Mac

You can check out How to Install Pip article to learn how to install Pip.

Support Jun

Thank you for reading!

If you are preparing for Software Engineer interviews, I suggest Elements of Programming Interviews in Java for algorithm practice. Good luck!

You can also support me by following me on Medium or Twitter.

Feel free to contact me if you have any questions.

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

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.

How To Update Python 3.8 Mac

Check If A Python Package Is Installed

Upgrade

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.

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.

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 In Mac Terminal

Downgrade Python Package To The Specific Version

How To Update Python 2.7 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.