pybind11“ Python是64位的,选择的编译器是32位的”

Per*_*nce 5 cmake visual-studio-2015 pybind11

我正在尝试在安装了VisualStudio 2015的Windows计算机上编译pybind11。我还安装了python 3.5.3 64bit和cmake 2.8.12。我得到错误:

CMake Error at tools/FindPythonLibsNew.cmake:122 (message):
  Python config failure: Python is 64-bit, chosen compiler is 32-bit
Call Stack (most recent call first):
  tools/pybind11Tools.cmake:16 (find_package)
  CMakeLists.txt:28 (include)
Run Code Online (Sandbox Code Playgroud)

我没有“选择”编译器为32位,并且在CMakeLists.txt中,我没有找到指定运行哪个编译器的地方。那么如何告诉pybind11 / cmake编译为64位呢?

Cal*_*leb 7

您应该像这样指定64位VS编译器:

cmake "/path/to/src/" -G"Visual Studio 14 2015 Win64"
Run Code Online (Sandbox Code Playgroud)

否则,它将默认选择32位。

  • 就我而言,Windows 10 Visual Studio Community `cmake CMakeLists.txt -G"Visual Studio 16 2019" -A x64` (2认同)