问题
I'm trying to download YouCompleteMe for Vim on Windows following this tutorial.
When calling CMake:
cmake -G "Visual Studio 14 Win64" -DPATH_TO_LLVM_ROOT=%USERPROFILE%/ycm_temp/llvm_root_dir . %USERPROFILE%/vimfiles/bundle/YouCompleteMe/third_party/ycmd/cpp
It throws the following exception:
CMake Error at C:/Program Files/CMake/share/cmake-3.9/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
Could NOT find PythonLibs (missing: PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS)
(Required is at least version "2.6")
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.9/Modules/FindPackageHandleStandardArgs.cmake:377 (_FPHSA_FAILURE_MESSAGE)
C:/Program Files/CMake/share/cmake-3.9/Modules/FindPythonLibs.cmake:262 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
CMakeLists.txt:189 (find_package)
I have installed python-2.7.13, and put it under PATH
in Environment Variables
.
What should I do to fix the exception?
回答1:
Instead of using:
cmake -G "Visual Studio 14 Win64" -DPATH_TO_LLVM_ROOT=%USERPROFILE%/ycm_temp/llvm_root_dir . %USERPROFILE%/vimfiles/bundle/YouCompleteMe/third_party/ycmd/cpp
You should set the DPYTHON_INCLUDE_DIR
and DPYTHON_LIBRARY
flags to something like below:
-DPYTHON_INCLUDE_DIR=C:\Python27\include \
-DPYTHON_LIBRARY=C:\Python27\libs
If you use the default install path (C:\Python27), the full command is shown below:
cmake -G "Visual Studio 14 Win64" -DPATH_TO_LLVM_ROOT=%USERPROFILE%/ycm_temp/llvm_root_dir . %USERPROFILE%/vimfiles/bundle/YouCompleteMe/third_party/ycmd/cpp -DPYTHON_INCLUDE_DIR=C:\Python27\include -DPYTHON_LIBRARY=C:\Python27\libs
来源:https://stackoverflow.com/questions/44601548/cmake-could-not-find-pythonlibs