Quantlib-SWIG 1.12.x for Python错误,Windows中缺少Quantlib/quantlib_wrap.cpp [英] Quantlib-SWIG 1.12.x for Python error, missing Quantlib/quantlib_wrap.cpp in windows

查看:175
本文介绍了Quantlib-SWIG 1.12.x for Python错误,Windows中缺少Quantlib/quantlib_wrap.cpp的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从github下载了Quantlib-SWIG 1.12.x和Quantlib1.12.x. Quantlib编译时没有和问题.这些示例正常运行.但是,在运行python setup.py build时,出现错误,指示缺少quantlib_wrap.cpp.在哪里可以下载适用于该版本的quantlib_wrap.cpp或此错误与其他内容有关?这是我从此版本中获得的消息.

I downloaded both Quantlib-SWIG 1.12.x and Quantlib 1.12.x from github. Quantlib is compiled without and problems. The examples ran normally. However, when run python setup.py build, there is an error indicating missing quantlib_wrap.cpp. Where to download the proper quantlib_wrap.cpp for this version or this error is related to something else? Here is the messages I got from this build.

C:\Users\Public\3rdParty\Libraries\QuantLib-SWIG-1.12.x\Python>python setup.py build
running build
running build_py
file QuantLib\QuantLib.py (for module QuantLib.QuantLib) not found
file QuantLib\QuantLib.py (for module QuantLib.QuantLib) not found
running build_ext
building 'QuantLib._QuantLib' extension
C:\Users\U435169\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -D__WIN32__ -DWIN32 -DNDEBUG -D_WINDOWS -DNOMINMAX -Id:\packages\Python27\include -Id:\packages\Python27\PC -IC:\Users\Public\3rdParty\Libraries\QuantLib-master /TpQuantLib/quantlib_wrap.cpp /Fobuild\temp.win32-2.7\Release\QuantLib/quantlib_wrap.obj /GR /FD /Zm250 /EHsc /bigobj /MD
quantlib_wrap.cpp
c1xx : fatal error C1083: Cannot open source file: 'QuantLib/quantlib_wrap.cpp': No such file or directory
error: command 'C:\\Users\\U435169\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\cl.exe' failed with exit status 2

推荐答案

quantlib_wrap.cpp由SWIG使用存储库中的源生成.如果安装了SWIG,则可以生成它(请参见 https://www.quantlib. org/install/windows-python.shtml );但是如果您没有修改源的计划,建议您:

quantlib_wrap.cpp is generated by SWIG using the sources in the repository. If you have SWIG installed, you can generate it (see https://www.quantlib.org/install/windows-python.shtml); but if you don't have plans to modify the sources, I suggest that you either:

  • instead of cloning the repo from GitHub, download an official release (see https://www.quantlib.org/download.shtml); released sources include quantlib_wrap.cpp;

或更好的方法,如上面链接的安装页面中所述,请尝试运行

or better yet, as suggested in the install page linked above, try running

pip install QuantLib-Python

查看PyPI是否提供了预编译的Python模块.如果成功的话,您将无需自己编译即可进行设置.

to see if a precompiled Python module is available from PyPI. If that succeeds, you'll be set without having to compile the thing yourself.

这篇关于Quantlib-SWIG 1.12.x for Python错误,Windows中缺少Quantlib/quantlib_wrap.cpp的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆