Currently seeking new career opportunities in web development, particularly with Laravel, Hire Me

Run Python 3 as default when Python 2 is installed on a Mac

David Carr

Tutorials Python

I’ve started to learn Python version 3 I had Python 2 already installed so when typing ‘python’ in terminal python 2 was being executed. To run 3 I had to type python3 while that works I would prefer to run 3 as default. This can be done by creating an alias.

First open your bash profile:

nano ~/.bash_profile

This will open the profile if it exists, otherwise it will create it.

Next create the alias so when ‘python’ is typed python3 will be executed:

alias python='python3'

Save the file by pressing ctrl + x and y to confirm the changes, you may need to restat terminal for the alias to be available.

This allows Python 3 to be ran by default without touching Python 2.

Laravel Modules Your Logo Your Logo Your Logo

Become a sponsor

Help support the blog so that I can continue creating new content!

Sponsor

My Latest Book

Modular Laravel Book - Laravel: The Modular way

Learn how to build modular applications with Laravel Find out more

Subscribe to my newsletter

Subscribe and get my books and product announcements.

Learn Laravel with Laracasts

Faster Laravel Hosting

© 2006 - 2024 DC Blog. All code MIT license. All rights reserved.