I haven\'t touched python and virtualenv in a while, and I believe I setup my MBP with virtualenv and pip, but have totally forgotten how this stuff works.
After ins
I had to reinstall setup-tools (in this case, the Python 2.7 egg for Mountain Lion), and then I was able to reinstall pip, and then virtualenv.
I am a complete Python/Virtualenv novice. However, I had the exact same problem and found a solution that worked for me. I believe that this will vary greatly depending upon the way you originally setup Python & Virtualenv.
In my case, the Lion upgrade completely wiped out all contents of my /Library/Python/2.*/site-packages
, but left the now broken executables (which link to the contents of this folder) in /usr/local/bin
. I believe that this is the root cause of the cryptic "No module" import errors.
Reviewing my .bash_history, I had originally used easy_install
to install pip
, and then pip
to install virtualenv
and virtualenvwrapper
. Once I repeated these steps, then I was able to re-enter my old virtual environments which still contained all the packages I had installed on 10.6. Note, however, that 10.6 shipped with Python 2.6 as default. If your packages require Python 2.6, you should change your default Python version to 2.6 first.
Step-by-step:
.bash_profile
). Start a new terminal session.defaults write com.apple.versioner.python Version 2.6
sudo easy_install pip
. It seems as though /Library/Python/2.*/site-packages
now requires administrator privileges. I don't recall that being the case in 10.6 (or at least my bash history doesn't reflect that).sudo pip install virtualenv
sudo pip install virtualenvwrapper
pip freeze -l
to see local packages in this virtual environment). I think.To fix the second problem you should reinstall setuptools.
And to fix the first one, just install virtualenvwrapper with that.
Basically, when you install Lion, you'll have to reinstall all your python site-packages.