简体   繁体   English

用python SWIG安装quantlib

[英]installing quantlib with python SWIG

hi i am trying to install quantlib for python with SWIG bindings, and I get the following error. 嗨,我试图安装带有SWIG绑定的python的Quantlib,但出现以下错误。 I am on Windows 7, have Python 2.7 64 bit and built quantlib 1.5 with MS Visual Studio Express 2008 where I had performed all the steps outlined in https://jenshuebel.wordpress.com/2009/02/12/visual-c-2008-express-edition-and-64-bit-targets/ to compile 64 bit code: 我在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'

Seems you want to build a version for 32-Bit Python but you have active the 64_Bit Toolchain of Visual Studio. 似乎您要为32位Python构建版本,但是您已经激活了Visual Studio的64位工具链。

The solution might be to enable the Visual Studio 32-Bit Toolchain before starting the build of the quantlib python library. 解决方案可能是在开始建立quantlib python库之前启用Visual Studio 32位工具链。

Have a look on the appropriate documentation on the msdn pages: 请查看msdn页面上的相应文档:

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

Can not test it myself because i have no visual studio 2008 installed. 我自己无法测试,因为我没有安装Visual Studio 2008。 But i have had the same problem with VS2015 when i tried to build for 64-Bit python with the 32-bit toolchain. 但是当我尝试使用32位工具链构建64位python时,我也遇到了VS2015的相同问题。

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

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