There are many ways in which you can install Python on a Mac, directly from Python.org using dmg files or using the brew package manager.
Most macOS comes bundled with the latest version of Python 3.x as well as Python 2.7 and you may have installed others for your projects.
If you are wondering how to easily access these different versions using a Mac terminal, then the best way is to create an alias for them.
Based on which Terminal Shell you use, open the profile file ~/.bashrc or ~/.zshrc and add the aliases for different Python versions you have.Example:
# Alias for Python 2.7 alias python2='/usr/bin/python2.7' # Alias for Python 3.8 alias python3.11='/Library/Frameworks/Python.framework/Versions/3.8/bin/python3' # Alias for Python 3.9 alias python3.11='/Library/Frameworks/Python.framework/Versions/3.9/bin/python3' # Alias for Python 3.11 alias python3.11='/Library/Frameworks/Python.framework/Versions/3.11/bin/python3'
Save and refresh the prompt and now you can easily access any Python version by simply using the. version number.
Facing issues? Have Questions? Post them here! I am happy to answer!
- Clear Screen shortcut macOS Terminal
- What is macOS Ventura?
- [fix] How to Show file extensions on all files on Mac
- How to Find Where Mac Terminal App is Located?
- AutoSave button not working on Office on Mac (Word, Excel or Powerpoint)
- macOS say command text to speech using various voices and languages
- How to change Ping TTL value on macOS
- Open .bash_profile File in TextEdit using Terminal
- How to know the Safari Version on Mac
- How to Copy full Absolute Path of a File on Mac
- 13.0 MacOS Ventura release date
- Enable spell check in Sublime Text (macOS)
- How to Display Analog Clock on Mac Menu Bar
- How to turn off Location Services macOS Ventura 13
- How to Open VS Code on Mac
- Add Bookmark macOS Safari
- How to Fix cd: too many arguments Error in Terminal: A Step-by-Step Guide
- How to install wget on macOS
- Select Line Number TextEdit on Mac
- Strikethrough Text in Excel for Mac
- How to Enable or Disable Dark Mode on macOS Ventura 13
- How to hide or display Wifi icon in macOS Bug Sur Menu Bar
- How to install Yarn on Mac (macOS)
- How to fix command not found brew (bash, zsh) on macOS Terminal
- How to Schedule Mails in macOS Ventura
- Where does Notepad++ save temp files? - NotepadPlusPlus
- Android Installation error: INSTALL_FAILED_OLDER_SDK on Device - Android
- [Docker] Install Git on Alpine Linux - Docker
- How to Install Git on Ubuntu Linux - Git
- SharePoint - The URL is invalid. It may refer to a nonexistent file or folder, or refer to a valid file or folder that is not in the current Web. - SharePoint
- How to fully uninstall Conda on Windows - HowTos
- PHP Base64 encoding decoding a variable - PHP
- Limit scrollback rows in macOS Terminal - MacOS