Cmake无法找到PythonLib

时间:2017-06-17 06:30:40

标签: python windows python-2.7 vim cmake

我试图在YouCompleteMe之后在Windows上为Vim下载this tutorial

致电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,并将其放在PATH的{​​{1}}下。

我该怎么做才能解决这个异常?

1 个答案:

答案 0 :(得分:4)

而不是使用:

Environment Variables

您应该将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标志设置为如下所示:

DPYTHON_LIBRARY

如果使用默认安装路径(C:\ Python27),则完整命令如下所示:

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