Day 2: Python Installation on Mac

OSX comes with Python installed, however as of date OSX comes with version 2. Newer version of OSX will come with version 3 installed.

  1. There is a nice video on removing version 2 from older OSX. Watch here.
  2. Download and run Python v3 from https://www.python.org/downloads/

or use homebrew

brew install python3

Now that Python v3 is installed, there is one small problem. On terminal, running the python command won’t work, or if you did not remove version 2, the runtime for version 2 will open, instead of version 3.

$ python
zsh: command not found: python

Try “python3” instead

$ python3
Python 3.10.3 (v3.10.3:a342a49189, Mar 16 2022, 09:34:18) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>

I’m not fond of writing long commands, so I will add an alias to my .zshrc file

nano ~/.zshrc

add this

alias py='python3'
$ py
Python 3.10.3 (v3.10.3:a342a49189, Mar 16 2022, 09:34:18) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>

That concludes for this day!

What’s your Reaction?
+1
0
+1
0
+1
0

Published by Soumil Roy

I'm a Full-Stack Developer with 7+ years of experience in Web design & development .Currently building expertise in React, TypeScript & GraphQL

Leave a comment

Your email address will not be published.

Open WhatApp
Hello 👋 Click the button below connect with me.