install YCM error: python site module not loaded
<p>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 <code>E887: Sorry, this command is disabled, the Python's site module could not be loaded.</code> </p>

<p>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. </p>

<p>My OS version is MacOS Sierra (10.12). </p>

<p><code>which python</code> returns <code>/usr/local/bin/python</code> and <code>python --version</code> gives <code>Python 2.7.12</code>. Typing <code>:echo has('python')</code> returns 1.</p>

<p>Any suggestions? Thanks!</p>

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

<pre><code>/usr/local/Cellar/python/2.7.12_1/Frameworks
</code></pre>

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

<pre><code>-lc -F/usr/local/Cellar/python/2.7.12/Frameworks -framework Python
</code></pre>

<p>(see <code>vim --version | grep python</code>)</p>

<p>To fix this, I did the following;</p>

<pre><code>brew uninstall python vim
brew install python
brew install vim --build-from-source
</code></pre>

<p>Now, <code>vim --version | grep python</code> shows vim is correctly linked to the correct python Framework dir.</p>

python vim homebrew macvim youcompleteme