Please complete these steps and check these boxes (by putting an x inside
the brackets) _before_ filing your issue:
vim --version.:YcmDebugInfo.:YcmToggleLogs command.Thank you for adhering to this process! It ensures your issue is resolved
quickly and that neither your nor our time is needlessly wasted.
I have Anaconda installed but I am afraid it is not supported. So I want to know how can I specify the python used with YCM? I just want to use /usr/bin/python.
I have Anaconda installed but I am afraid it is not supported
No we don't support anaconda.
So I want to know how can I specify the python used with YCM?
Which Python used by YCM are you referring to? Can you elaborate a little?
I have /Users/XXX/anaconda/bin in the PATH, so when I run python it is the anaconda one. But when building and running YCM, I want the python used is /usr/bin/python. How can I do this?
Try the docs?
https://github.com/Valloric/YouCompleteMe#the-gycm_server_python_interpreter-option
I mean the python libraries used when ./install.py. I install YCM with anaconda python and use YCM completing anaconda libraries and everything seems ok. I don't know why.
If everything works fine where is the problem then?
I have /Users/XXX/anaconda/bin in the PATH, so when I run python it is the anaconda one. But when building and running YCM, I want the python used is /usr/bin/python. How can I do this?
YCM is built with the Python used to run the install.py script so if you want regular Python, you should execute the command:
/usr/bin/python install.py
I mean the python libraries used when ./install.py. I install YCM with anaconda python and use YCM completing anaconda libraries and everything seems ok. I don't know why.
We may not support Anaconda but that doesn't mean it's not supposed to work with it.
Thank you. YCM now is perfect in Python completion.
I thought that you were asking how to change the Python used to build YCM but what you really want is to specify the Python used to complete code. By default, YCM completes Python code with the same interpreter as the one used to compile YCM but you can change that with the g:ycm_python_binary_path option. In your case, you could set this option in your vimrc to:
let g:ycm_python_binary_path = '/usr/bin/python'
See the Python Semantic Completion section in the docs for more detail.
You can also change the Python interpreter on the fly with the RestartServer subcommand. For instance, if you want to switch back to Anaconda, you could type the following command while editing a Python file in Vim:
:YcmCompleter RestartServer /path/to/anaconda/interpreter
Okay, I think I didn't convey my thoughts explicitly.
About six months ago, I installed YCM on my MacBook Pro and make clang-completion work perfectly with a brew vim and system python. Then one day, I recover my OS X and install brew vim and brew python (I don't know why brew python is needed, but brew install vim just installs python as well.), and clang-completion with YCM didn't work since then. I doubt it is a python problem but I can't figure it out so I gave up configuring YCM.
Recently, I began to use python and reinstall YCM for python completion. I still can't figure out which python I should use so I came for help. And now, YCM works perfectly.
Thank you all!
I see. The "YCM now is perfect in Python completion" confused me. I am closing the issue then.
Most helpful comment
I thought that you were asking how to change the Python used to build YCM but what you really want is to specify the Python used to complete code. By default, YCM completes Python code with the same interpreter as the one used to compile YCM but you can change that with the
g:ycm_python_binary_pathoption. In your case, you could set this option in your vimrc to:See the Python Semantic Completion section in the docs for more detail.
You can also change the Python interpreter on the fly with the
RestartServersubcommand. For instance, if you want to switch back to Anaconda, you could type the following command while editing a Python file in Vim: