2017-06-17 152 views
1

我想下載YouCompleteMe for Vim在Windows下面this tutorialCmake找不到PythonLibs

當調用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 

它拋出以下異常:

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) 

我已經安裝了Python-2.7.13,並把它放在Environment VariablesPATH下。

我應該怎麼做才能修復異常?

回答

1

而不是使用:

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_DIRDPYTHON_LIBRARY標誌,以類似下面:

-DPYTHON_INCLUDE_DIR=C:\Python27\include \ 
-DPYTHON_LIBRARY=C:\Python27\libs 

如果使用默認安裝路徑(C:\ Python27)時,完整命令如下所示:

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