简体   繁体   English

CMake find_package(PythonLibs)无法正常工作

[英]CMake find_package(PythonLibs) not working

I am trying to use Python.h in a C++ project compiled with g++. 我试图在用g ++编译的C ++项目中使用Python.h I am using CMake to generate proper include/lib links. 我正在使用CMake生成正确的包含/库链接。 I am using the built-in feature 我正在使用内置功能

find_package(PythonLibs REQUIRED)

but cannot get it working. 但无法正常运作。 I have been looking in FindPythonLibs.cmake to see what CMake was looking for and I found some registry keys that were missing on my machine. 我一直在寻找FindPythonLibs.cmake以查看CMake在寻找什么,并且发现了我的计算机上缺少的一些注册表项。 For example in the PYTHON_INCLUDE_DIR section : [HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Python\\\\PythonCore\\\\${_CURRENT_VERSION}\\\\InstallPath]/include 例如,在PYTHON_INCLUDE_DIR部分中: [HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Python\\\\PythonCore\\\\${_CURRENT_VERSION}\\\\InstallPath]/include

Here is what I found in my registry : 这是我在注册表中找到的内容:

  • HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Python.CompiledFile
  • HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Python.File
  • HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Python.NoConFile

I have my Python files installed in C:/Python33 and find_package(PythonInterp) is working fine (maybe because it finds the .exe file without having to hit the registry). 我在C:/Python33安装了我的Python文件,并且find_package(PythonInterp)正常运行(也许是因为它找到了.exe文件而不必点击注册表)。 Seems like some things are missing... Is there a quick way to fix this ? 似乎缺少了某些东西...是否有解决此问题的快速方法?

[Setup] : Python 3.3.2, Win8 64bit [设置]:Python 3.3.2,Win8 64位

我有一个32位的MinGW和一个64位的Python发行版...我安装了32位的Python发行版,现在find_package(PythonLibs)正在运行。

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

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