Cmake找不到PythonLib [英] Cmake Could NOT find PythonLibs

查看:202
本文介绍了Cmake找不到PythonLib的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Windows上为Vim下载 YouCompleteMe 本教程.

I'm trying to download YouCompleteMe for Vim on Windows following 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 下.

I have installed python-2.7.13, and put it under PATH in 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 标志设置为如下所示:

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

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

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

这篇关于Cmake找不到PythonLib的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆