pybind11 "Python is 64-bit, chosen compiler is 32-bit"
pybind11 "Python is 64-bit, chosen compiler is 32-bit"
我正在尝试在安装了 VisualStudio 2015 的 Windows 机器上编译 pybind11。我还安装了 python 3.5.3 64 位和 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)
我没有 "choose" 编译器是 32 位的,并且查看 CMakeLists.txt,我没有找到任何地方指定要 运行 的编译器。
那么如何告诉 pybind11/cmake 编译 64 位?
您应该像这样指定 64 位 VS 编译器:
cmake "/path/to/src/" -G"Visual Studio 14 2015 Win64"
否则默认选择32位
如果您使用的是 Ninja 生成器并且出现此错误,请确保您 运行 64 位模式下的 VS Dev 命令提示符:
VsDevCmd.bat arch=amd64 && cmake <options> ...
您可以:
cmake .. -G"Visual Studio 14 2015 Win64"
cmake --build . --config Release --target check
或基于为 windows 编译测试用例部分 here 中的引述:
If all tests fail, make sure that the Python binary and the testcases
are compiled for the same processor type and bitness (i.e. either i386
or x86_64). You can specify x86_64 as the target architecture for the
generated Visual Studio project using cmake -A x64 ..
你可以这样做:
cmake -A x64 ..
cmake --build . --config Release --target check
我正在尝试在安装了 VisualStudio 2015 的 Windows 机器上编译 pybind11。我还安装了 python 3.5.3 64 位和 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)
我没有 "choose" 编译器是 32 位的,并且查看 CMakeLists.txt,我没有找到任何地方指定要 运行 的编译器。 那么如何告诉 pybind11/cmake 编译 64 位?
您应该像这样指定 64 位 VS 编译器:
cmake "/path/to/src/" -G"Visual Studio 14 2015 Win64"
否则默认选择32位
如果您使用的是 Ninja 生成器并且出现此错误,请确保您 运行 64 位模式下的 VS Dev 命令提示符:
VsDevCmd.bat arch=amd64 && cmake <options> ...
您可以:
cmake .. -G"Visual Studio 14 2015 Win64"
cmake --build . --config Release --target check
或基于为 windows 编译测试用例部分 here 中的引述:
If all tests fail, make sure that the Python binary and the testcases are compiled for the same processor type and bitness (i.e. either i386 or x86_64). You can specify x86_64 as the target architecture for the generated Visual Studio project using cmake -A x64 ..
你可以这样做:
cmake -A x64 ..
cmake --build . --config Release --target check