
If you continue to have the original Python 2.7.x release installed on the Mac, it remains accessible and usable by specifying the full path, like so: This should be the same response as if you type, since the python command has been aliased to python3: Now you can confirm the alias worked by checking the python version: Hit Control-O and then Control-X to save the edit and then exit out of nano.Add the following alias at the bottom of the.From the Terminal, open zshrc in your text editor of choice, we’ll use nano for the sake of ease:.zshrc, but if you still use bash then you’d add the alias into.

We are assuming you’re using the default Zsh shell (or Oh My Zsh) and thus modifying. How to Make Python 3 the Default in MacOS Again, you can also install it using the Python 3 installer, or even the MacAdmins Python release if you’d prefer. This will install the latest Python 3 release available through HomeBrew.

If you haven’t installed Python 3 yet it’s easy to do so with a single homebrew command: If you already installed Python 3 on the Mac using the official Python installer from here or Homebrew, you can skip this section. If you want to modify your path so one Python has precedence over the other, you can update your PATH in your. This is one reason I recommend creating a virtual environment and explicitly activate it (see the next section on virtual environment). The system Python (in /usr/bin/) may end up in your PATH environment variable before your installed version (in /usr/local/bin/). Homebrew and the official Python installer will both symlink executables to /usr/local/bin/python3 depending on which one was installed last. The /usr/bin/python3 is the system Python, and the one you want to avoid using. You can use where python3 or where idle3 to see which executables you have available in your path. They can all co-exist if you know what you are doing, but I recommend choosing either the Homebrew method or the official installer and not both.

It can get confusing and you may accidently install a package to one version of Python while your IDE is using a different version. In addition to the system Python 2 and Python 3, you can also have Python 3 installed from the official installer as well as Homebrew's Python 3 all at once. It is possible to have multiple versions of Python installed.
