Fixing Python in OS X Mavericks

After upgrading to OS X 10.9 Mavericks, I found some the tools I'm relying on (Bazzar etc) stopped working because of the changes made in the default Python environment.

So here are some quick notes to fix the environment.

Install Xcode Command Line tools

xcode-select -- install

Install Homebrew (If you haven't installed yet)

ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"

If you already have brew installed, just make sure its the newest version

brew update
brew upgrade

Check your brew environment with

brew doctor

And fix the issues it reported

Install Python with brew (Going to use this one instead of the one come with the system)

brew install python --with-brewed-openssl

The Python in brew comes with pip and setup_tools and you don't have to use pip with sudo.

If you want virtualenv

pip install virtualenv
pip install virtualenvwrapper

If you have PYTHONPATH issues (For example, you want Bazzar)

Go to the Python shell and type

import sys
':'.join(sys.path)

Copy and paste the result string and back to terminal type

echo export PYTHONPATH='YOUR sys.path' >> ~/.bash_profile

If you are using zsh

echo export PYTHONPATH='YOUR sys.path' >> ~/.zshrc

blog comments powered by Disqus