Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save epicserve/3180261 to your computer and use it in GitHub Desktop.
Save epicserve/3180261 to your computer and use it in GitHub Desktop.
How to fix your python virtualenvs after installing OS X 10.8 Mountian Lion

Ran the following so virtualenvwrapper worked again:

$ sudo curl https://raw.github.com/pypa/pip/master/contrib/get-pip.py | sudo python
$ sudo pip install virtualenvwrapper

After I tried using django-admin.py runserver in a virtualenv I got the following error.

IOError: [Errno 2] No such file or directory: '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/__init__.py'

Running the following fixed that error:

$ cd /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/
$ sudo touch __init__.py

In order to get my dev version for django-environment to work I had to do the following:

$ cd /Library/Python/2.7/site-packages/virtualenvwrapper
$ sudo ln -s ~/Code/django/django-environment/virtualenvwrapper/django_env.py
@kennethreitz
Copy link

The solution is to not use system Python for development.

@kennethreitz
Copy link

Because it isn't Python.

@epicserve
Copy link
Author

Yeah, I've thought about using homebrew to install Python. Any gotchas by using homebrew to install Python?

@kennethreitz
Copy link

Not at all, I highly commend it :)

@maltebeckmann
Copy link

Hey kenneth, could you elaborate on system Python vs installed Python via homebrew? I am developing on 10.7 and had to realize things were not as easy to maintain as on Ubuntu. And how do you guys deal with Postgres on OS 10.7 and or 10.8 on which it's already running? What if you needed to upgrade Postgres to another version, doesn't that impact on dependent system apps of Mac OS?

@kennethreitz
Copy link

@epicserve
Copy link
Author

@maltebeckmann, I'm using Postgres installed via Homebrew and have been for years. I'm happy with it. I haven't tried the new Postgres.app made by Heroku. I just recently switched to Python 2.7.3 installed via Homebrew and it seems a little faster than the system Python. The nice thing is that I won't have to worry about upgrading the OS breaking my python environment now. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment