0

嗨,我正在尝试使用 SWIG 绑定为 python 安装 quantlib,但出现以下错误。我在 Windows 7 上,有 Python 2.7 64 位,并使用 MS Visual Studio Express 2008 构建了 quantlib 1.5,我已经执行了https://jenshuebel.wordpress.com/2009/02/12/visual-c-中列出的所有步骤2008-express-edition-and-64-bit-targets/编译 64 位代码:

running build
running build_py
copying QuantLib\QuantLib.py -> build\lib.win-amd64-2.7\QuantLib
running build_ext
building 'QuantLib._QuantLib' extension
c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -D__WIN32__ -DWIN32 -DNDEBUG -D_WINDOWS -DNOMINMAX -IC:\Anaconda1\include -IC:\Anaconda1\PC -IC:\Users\nick11\Documents\software\QuantLib-1.5 -IC:\Boost\boost_1_57_0 /TpQuantLib/quantlib_wrap.cpp /Fobuild\temp.win-amd64-2.7\Release\QuantLib/quantlib_wrap.obj /GR /FD /Zm250 /EHsc /MD
quantlib_wrap.cpp
C:\Boost\boost_1_57_0\boost/type_index.hpp(37) : warning C4068: unknown pragma
QuantLib/quantlib_wrap.cpp(13920) : warning C4018: '<' : signed/unsigned mismatch
c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\link.exe /DLL /nologo /INCREMENTAL:NO /LIBPATH:C:\Anaconda1\libs /LIBPATH:C:\Anaconda1\PCbuild\amd64 /LIBPATH:C:\Users\stathis1\Documents\software\QuantLib-1.5\lib /LIBPATH:C:\Boost\boost_1_57_0\libs /LIBPATH:C:\Users\nick1\Documents\software\QuantLib-1.5\lib /EXPORT:init_QuantLib build\temp.win-amd64-2.7\Release\QuantLib/quantlib_wrap.obj /OUT:build\lib.win-amd64-2.7\QuantLib\_QuantLib.pyd /IMPLIB:build\temp.win-amd64-2.7\Release\QuantLib\_QuantLib.lib /MANIFESTFILE:build\temp.win-amd64-2.7\Release\QuantLib\_QuantLib.pyd.manifest /subsystem:windows /machine:I386
python27.lib(python27.dll) : fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86'
4

1 回答 1

1

似乎您想为 32 位 Python 构建一个版本,但您已经激活了 Visual Studio 的 64_Bit 工具链。

解决方案可能是在开始构建 quantlib python 库之前启用 Visual Studio 32 位工具链。

查看 msdn 页面上的相应文档:

https://msdn.microsoft.com/en-us/library/x4d2c09s%28v=vs.90%29.aspx

无法自己测试,因为我没有安装 Visual Studio 2008。但是当我尝试使用 32 位工具链为 64 位 python 构建时,我遇到了与 VS2015 相同的问题。

于 2015-09-12T22:31:07.680 回答