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

Practical ProGuard rules examples

The Software Engineer’s Complete Guide to Code Quality

graphic of person working at a laptop

Automation: Building a Reservation/Waiting List Text-Bot For My Weekly Poker Games

Content Sharing with a Skype-registered Polycom Group Series

Implements a basic search filter and column sort with pagination in Laravel CRUD

Why TextMate 2 is My Favorite Code Editor for Mac (Part III)

Tech Gurus and Trend Followers Wondered Why Microsoft Pivoted Into Open-source?!!

Learn SQL Techniques: Selecting Data and More in SQL Server

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

Python for Databases

GraphQL with Python — Part-1

GET requests with Python, ORDS, and the Oracle Autonomous Database

Objects in SQL Worksheet in Oracle Autonomous Database, Chris Hoina, Senior Product Manager, ORDS, Database Tools,

How to run background scripts with python’s fast api framework