Make python3 as default python version in Mac

python icon from wikipedia

Python3 has been the default version since python2 has sunset from January 1, 2020.
https://www.python.org/doc/sunset-python-2/

While you install python in your machine, most likely you will get python and python3 . It may seem like troublesome if we need to specific python , one of the solution is to use alias in your shell.

PROFILE

vi ~/.profile
alias pip=pip3
alias python=python3

After you edit the file, do a source ~/.profile

ZSH

vi ~/.zshrc
alias pip=pip3
alias python=python3

After you edit the file, do a source ~/.zshrc

BASH

vi ~/.bashrc
alias pip=pip3
alias python=python3

After you edit the file, do a source ~/.bashrc

Pyenv

Or you can use pyenv to manage the python version.

brew update
brew install pyenv

Do take note if you are using windows, please consider using @kirankotari’s pyenv-win fork. (pyenv does not work on windows outside the Windows Subsystem for Linux)

Validation

That’s it! You have made python3 as default version on Mac!

Stay safe and healthy! Till next time~

Reference from stack overflow

--

--

--

https://www.youracclaim.com/users/jia-hao-chu/

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

3rd Week of the 2nd phase in EncorAcademy

from Buffer

Git Time Travel Magic — Amend / Rebase

How to create a pipeline in Jenkins with an example.

How To Get Wi-Fi Working on a Dell XPS 13 9343 (Broadcom BCM4352) Running Ubuntu 20.10

IBM Power Systems, Red Hat OpenShift and Dynatrace — an Excellent Trio

Dynatrace in a Red Hat OpenShift environment

To val, or to const val, that is the question

The Software Shift Towards ‘Replace’

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Daniel Chu

Daniel Chu

https://www.youracclaim.com/users/jia-hao-chu/

More from Medium

A simple API using Flask

Github Automation via Python

Docker Python Hello World

Best 5 Frameworks For Web Development