Homebrew macvim with python2.7.3 support not working

I installed macvim with homebrew, with python support. My spell was as follows:

brew install macvim --override-system-vim 

Now when I open the python file, I get a series of errors if I try to import something. for example, if I import re , I see ImportError: no module name re .

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

What does it mean and how to fix it?

+4
source share
3 answers

In the end, I abandoned the homebrew option and used the answer suggested here:

vim compiles with the wrong version of python (and does not work with the required version)

It seems like this cannot be done with brew. It looks like someone needs to fix the macvim distribution.

0
source

I got this quick hack job 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 
+23
source

My wild guess is that you have to add the home folder for installation to your .bash_profile, for example:

 export PATH=/usr/local/bin:/usr/local/sbin:usr/local/Cellar/python/2.7.3/bin:$PATH 

after that write in the shell "source.bash_profile" so that it reboots. Also check the output

 which python 

to make sure you use python homebrew

+1
source

All Articles