Zhiya Zhiya - 4 months ago 54
Python Question

install YCM error: python site module not loaded

So I really wanted to try YCM, which has been said to be a great plugin for Vim. I have been spending several hours on installation and cannot succeed due to the error of

E887: Sorry, this command is disabled, the Python's site module could not be loaded.

I installed MacVim, Vim, and Python using Homebrew. I reinstalled them so many times and still cannot get it done -- as many people suggested in the issues on YCM GitHub page.

My OS version is MacOS Sierra (10.12).

which python
python --version
Python 2.7.12
. Typing
:echo has('python')
returns 1.

Any suggestions? Thanks!


So I had this same problem on Sierra, home-brew seems to be placing the latest python here:


But brew install vim ends up trying to link to python from the wrong directory. Looking at vim --version | grep python I saw:

-lc -F/usr/local/Cellar/python/2.7.12/Frameworks -framework Python

(see vim --version | grep python)

To fix this, I did the following;

brew uninstall python vim
brew install python
brew install vim --build-from-source

Now, vim --version | grep python shows vim is correctly linked to the correct python Framework dir.