Having Python 3 in OSX Without Messing Up the Existing Python

475

2

1

About: Too much television as a kid.

You have python 2 pre-installed in OSX. But you want to have python 3 running alongside with it, so you don't mess up things that rely on the python 2. Here's how to do that!

Step 1: Install Homebrew

Install homebrew, the free missing package manager for OSX. You’re gonna want it anyway. Simply type this command in your OSX terminal (ruby is installed in your default OSX):

ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”


Step 2: Update Homebrew

Still in the OSX Terminal, update homebrew by typing this command at the prompt:

brew update

Step 3: Install Python 3

Still in the OSX Terminal, type this command:

brew install python3

Voila! You now have two different commands at your disposal: python and python3. You now also have pip3.

Henss-MBP:~ henszimmerman$ python3

Python 3.4.2 (default, Dec 21 2014, 10:52:15)

[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.56)] on darwin

Type “help”, “copyright”, “credits” or “license” for more information.

>>>


Share

    Recommendations

    • Classroom Science Contest

      Classroom Science Contest
    • IoT Challenge

      IoT Challenge
    • Woodworking Contest

      Woodworking Contest

    Discussions

    0
    None
    BenW231

    4 months ago on Step 3

    Under OSX 10.12.6:

    Typing:

    ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/instal...

    Results in:

    -e:1:in `"': undefined local variable or method `“' for main:Object (NameError)