[ solved ] How to upgrade Python 2.7 to Python 3 on your Mac

  • (0 votes)
  • Written by 
  • Wednesday, 07 July 2021 10:11

You can even run Python3 alongside a concurrent Python 2.7 installation without affecting the version 2.7 installation.

How we can do it?

1. Download the most recent package from the Python website and install latest package on your Mac.

2. Run terminaland write a command:

$ python --version
Python 2.7.6

$ python3 --version
Python 3.9.6

$ alias python=python3
$ python --version Python 3.9.6 #here your version latest to Python

 In regards to deleting the symbolic links Python2.7, I found this to be useful.

find /usr/local/bin -lname '../../../Library/Frameworks/Python.framework/Versions/2.7/*' -delete

 Now job done, try write in terminal $ python --version and you should be look Python 3.9.x

Same situation with pip, if you write in terminal $pip list and look $bash pip: command not found

Open the terminal and write

$ alias pip=pip3

$ pip --version
pip 21.1.3 from /usr/local/lib/python3.9/site-packages/pip (python 3.9)

 Jobe done and now you can write pip or pip3 - it's same like simlink.

4 Read Last modified on Wednesday, 07 July 2021

Leave a comment

Make sure you enter all the required information, indicated by an asterisk (*). HTML code is not allowed.