Cmake不能找到Python库 [英] Cmake is not able to find Python-libraries

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

问题描述

获取此错误:

sudo: unable to resolve host coderw@ll
-- Could NOT find PythonLibs (missing:  PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS) 
CMake Error at /usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:108     
(message):
Could NOT find PythonInterp (missing: PYTHON_EXECUTABLE)
Call Stack (most recent call first):
/usr/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:315  
(_FPHSA_FAILURE_MESSAGE)
/usr/share/cmake-2.8/Modules/FindPythonInterp.cmake:139 
(FIND_PACKAGE_HANDLE_STANDARD_ARGS)
Code/cmake/Modules/FindNumPy.cmake:10 (find_package)
CMakeLists.txt:114 (find_package)



-- Configuring incomplete, errors occurred!
See also "/home/coderwall/Desktop/rdkit/build/CMakeFiles/CMakeOutput.log".
See also "/home/coderwall/Desktop/rdkit/build/CMakeFiles/CMakeError.log".

我已经安装:


  1. sudo apt-get install python-dev

  2. 环境变量已设置如下:

  1. sudo apt-get install python-dev
  2. Environment variable are already set as follow:

PYTHON_INCLUDE_DIRS=/usr/include/python2.7 
PYTHON_LIBRARIES=/usr/lib/python2.7/config/libpython2.7.so


的位置python.h /usr/lib/include/python2.7/python.h

位置 python libs: /usr/lib/python2.7 /
如何解决?

Location of python libs: /usr/lib/python2.7/ How to solve this?

推荐答案

当我试图在Xubuntu 14.04 Thrusty Tahr系统上编译OpenCV 3时遇到这个问题。
在安装了所有的Python开发包后,配置过程总是返回以下消息:

I was facing this problem while trying to compile OpenCV 3 on a Xubuntu 14.04 Thrusty Tahr system. With all the dev packages of Python installed, the configuration process was always returning the message:

Could NOT found PythonInterp: /usr/bin/python2.7 (found suitable version "2.7.6", minimum required is "2.7")
Could NOT find PythonLibs (missing: PYTHON_INCLUDE_DIRS) (found suitable exact version "2.7.6")
Found PythonInterp: /usr/bin/python3.4 (found suitable version "3.4", minimum required is "3.4")
Could NOT find PythonLibs (missing: PYTHON_LIBRARIES) (Required is exact version "3.4.0")

Thrusty Tahr存储库上提供的CMake版本是2.8。
一些帖子激励我升级CMake。
我添加了一个PPA CMake仓库,安装CMake版本3.2。

The CMake version available on Thrusty Tahr repositories is 2.8. Some posts inspired me to upgrade CMake. I've added a PPA CMake repository which installs CMake version 3.2.

升级后,一切运行顺利,编译成功。

After the upgrade everything ran smoothly and the compilation was successful.

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

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