简体   繁体   English

Cmake找不到PythonLib

[英]Cmake Could NOT find PythonLibs

I'm trying to download YouCompleteMe for Vim on Windows following this tutorial . 我正在尝试按照本教程在Windows上下载YouCompleteMe for Vim。

When calling CMake: 调用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 . 我已经安装了python-2.7.13,并将其放在Environment Variables PATH下。

What should I do to fix the exception? 我应该怎么做才能解决该异常?

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_DIRDPYTHON_LIBRARY标志设置为如下所示:

-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: 如果使用默认安装路径(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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM