homebrew macvim with python2.7.3 support not working


Question

I installed macvim with homebrew, with python support. My incantation was as follow:

brew install macvim --override-system-vim

Now when I open a python file, I get a series of errors if I try to import anything. e.g. if I import re I see ImportError: no module name re.

The first time I open macvim after installing, I get 'import site' failed; use -v for traceback in the terminal where I opened macvim. This is after running my first python command.

What does this mean and and how do I fix it?

1
4
6/22/2012 12:23:30 AM

Accepted Answer

I ended up giving up on the homebrew option and using the answer suggested here:

vim compiles with wrong python version (and not working with needed version)

It's a shame it appears this cant be done via brew. Looks like somebody needs to patch the macvim distribution itself.

0
5/23/2017 11:51:02 AM

I got this working with a quick hack where you temporarily point the system python to your preferred python:

cd /System/Library/Frameworks/Python.framework/Versions
sudo mv Current Current-sys
sudo mv 2.7 2.7-sys
sudo ln -s /usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7 Current
sudo ln -s /usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7 2.7

brew rm macvim # optionall, only if you had it installed previously  
brew install macvim --override-system-vim

sudo mv Current-sys Current
sudo mv 2.7-sys 2.7

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon