All I want to do is. . .

. . .install Python 2 and/or 3.

OS:
Tags:

Contributors: sloria
Updated: 09/15/13

Do these first:

  • Install Homebrew
    # In your Mac Terminal, run:
    $ ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
    
    # In your ~/.bashrc, ~/.bash_profile, or ~/.zshrc (for zsh users)
    # ...
    export PATH=/usr/local/bin:$PATH
    
    $ brew doctor
    
     [full instructions]
  • Install the latest Mac C and C++ compilers
    # Get the latest version of Xcode from the Mac App Store
    # Here: https://developer.apple.com/xcode/
    
    # Open Xcode, then press `Command + ,` to open preferences
    
    # Click `Downloads` at the top of the window
    # Then click `Install` next to `Command Line Tools`
    
     [full instructions]

Updated 2013-09-15: Add Xcode compilers as a dependency.

# On Mac >= 10.5 with homebrew
$ brew update
## Install Python 2
$ brew install python
## Install Python 3
$ brew install python3
## Follow any instructions that appear after each brew install

Make sure to follow the instructions after each install. If you missed them, just run brew info python or brew info python3.

If it still doesn't work, try to fix every issue listed when you run brew doctor.

# Is everything working?
$ brew doctor
# Listen to the doctor

If everything's working, you can run both Python 2 and Python 3 on the same system.

# Run Python 2
$ python
# Run Python 3
$ python3
# Install a Python 2 package
$ pip install some-package
# Install a Python 3 package
$ pip3 install some-package

Raw: install-python.md


If you have suggestions, corrections, or content to contribute, fork us at our Github repo or open an issue.

Licensed under the CC-SA.