On Mac OS X using the python.org installer as you apparently have, you need to invoke Python 3 with python3, not python. That is currently reserved for Python 2 versions. That is currently reserved for Python 2 versions. Default meaning of Python on the command-line may not be clear. Python is usually an alias for python2.7 (but it can sometimes be an alias for older versions like python2.6 or python2.5). To find out exactly which version of Python you're using, you can use the -version flag. $ python -version Python 3 is usually available under the name of.
Pip is a popular command used to manage Python packages. Pip command is also used for updating/upgrading already installed Python packages. Install macos mojave on unsupported mac.
List Installed Python Packages
Python Upgrade Mac Os
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
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
Python Upgrade Mac Software
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 .
Upgrade Python Mac Command Line
Downgrade Python Package To The Specific Version
Python Upgrade 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.