This document describes how to install Python for different operating systems.
Go to the Python website to download an installation package according to your OS.
Python has dropped support for Python 2 since January 1, 2020. Therefore, you are advised to install Python 3.
Install the downloaded package as instructed.
If you use Windows, check Add Python to environment variables.
Run the following command in Terminal to view the Python version:
If the Python version is displayed, Python has been installed successfully.
If you use Windows, you may need to restart your computer after the installation.
In Windows, if “not recognized as an internal or external command” is reported in Terminal after the command above is run, right-click the Computer icon, click Properties > Advanced system settings > Environment Variables, and in the System variables area, click New to add the Python installation path:
Install HomeBrew and use it to install Python:
brew install python
Use the built-in Advanced Packaging Tool (APT) to install Python:
sudo apt-get install python
Use the built-in Yellowdog Updater, Modified (YUM) to install Python:
sudo yum install -y python