Wednesday, 07 July 2021 10:11

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

Written by
Rate this item
(0 votes)

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.

Read 527 times Last modified on Wednesday, 07 July 2021 10:33
Alex

Experienced Web Developer with a demonstrated history of working in the information technology and services industry.

Skilled in User Experience, Magento, Joomla, WordPress and IT Services.

Related items

  • [solved] How to install pip, BS4(Beautiful Soup), and update Python v2.7 to v3 on Mac
    in Mac

    MacOS comes with Python installed. But to make sure that you have Python installed open the terminal and run the following command.

    python --version

    If this command returns a version number that means Python exists. Which also means that you already have access to easy_install considering you are using macOS/OSX. Now, all you have to do is run the following command.

    sudo easy_install pip

    After that, pip will be installed and you'll be able to use it for installing other packages. For try if pip working well use:

    pip --version

    If you want install another modules - you can do this, for example:

    pip install regex

    Then runing

    sudo pip3 install beautifulsoup4
More in this category: « Let started use Amazon AWS