1

I am using OS X El Capitan and my default Python version is 2.7.10.

How can I change the default version to Python 3.5 for Terminal use?

2

3 Answers 3

27

El Capitan comes bundled with 2.7 and is used internally, so its best you don't do anything with it.

The easiest way is to download the Mac installer,

https://www.python.org/ftp/python/3.5.0/python-3.5.0-macosx10.6.pkg

Install it by following the steps in the GUI, go to terminal and to start python type,

python3

For Brew, kindly refer to the document,

Installing Python on Mac OS X

It has a step-by-step guide to help you through the entire process of installing python 3.x

Regards.

1
  • It no longer appears to be possible to install python 3.5 via brew, as it appears to only support python3.6 now. When I used the first solution to install python 3.5.4, it appeared to work. (If you first install python 3.5.0 and then realize you want 3.5.4, the installer uses the same path, in my case /Library/Frameworks/Python.framework/Versions/3.5 to install the later version.) Jan 3, 2018 at 16:13
10

Leave Python 2.X as it is.

Download Python either from https://www.python.org/ftp/python/3.5.0/python-3.5.0-macosx10.6.pkg or HomeBrew or via Anaconda from https://www.continuum.io/downloads.

add an alias in your ~/.bash_profile as follows

alias python='python3'

Hope that helped

0
0

you can use other answers and update your python version (actually you shouldnt update 2.7 because it makes problems for your applications that uses that version of python) OR

Use

Python3

Because you have it already

for your works like making virtual environments in that version.

My suggestion for you if you want to use different python versions on your system that could be so useful for ML and Data minings is USING

Pyenv

helps you manage you python versions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.