Choose the instructions for your operating system, install a currently supported Python 3 release, and verify that it runs from your terminal.
macOS
If you have Homebrew installed:
brew install python
python3 --version
Without Homebrew, download the macOS installer from the official python.org downloads page, run it, and follow the installer instructions.
Windows
- Open the official python.org downloads page
- Install a current Python 3 release
- If the installer offers to add Python to
PATH, enable that option - Open a new terminal and verify the installation:
python --version
If the python command is not found, try py --version.
Linux (Ubuntu/Debian)
Install Python from your distribution’s package repository:
sudo apt update
sudo apt install python3 python3-pip python3-venv
python3 --version
Do not remove or replace the system Python installation: the operating system may depend on it.
Verify the installation
On macOS and Linux, run:
python3 --version
python3 -m pip --version
python3 -c "print('Hello, Python!')"
On Windows, use python instead of python3. If only the py command is available, run py -m pip --version and py -c "print('Hello, Python!')".
Do you need pyenv?
You do not need it when you are just getting started. pyenv becomes useful when different projects require different Python versions. Install and configure it by following the project’s official instructions, because you must also enable its shell integration after installation.
Recommended development setup
- a currently supported Python 3 release;
- a code editor such as VS Code with the Python extension;
- a separate
venvvirtual environment for each project.
๐ฌ Comments (0)
No comments yet
Be the first to share your opinion about this article!