首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Quantlib SWIG python安装失败

Quantlib SWIG python安装失败
EN

Stack Overflow用户
提问于 2015-07-10 10:33:20
回答 1查看 389关注 0票数 0

我一直在尝试安装QuantLib,并想在Python中使用它。然而,我在构建Quantlib-SWIG时遇到了很大的麻烦,希望我能在这里得到一些帮助。

我能够按照http://quantlib.org/install/macosx.shtml的步骤构建Quantlib并成功运行所有测试套件(如果重要的话,我在Lion上)。在我下载并解压Quantlib-SWIG并尝试构建python setup.py后,我得到了很多错误,所有这些似乎都在某种程度上重复了以下内容:

代码语言:javascript
复制
QuantLib/quantlib_wrap.cpp:5640:   instantiated from ‘static int swig::traits_asptr<std::vector<T, std::allocator<_CharT> > >::asptr(PyObject*, std::vector<T, std::allocator<_CharT> >**) [with T = boost::shared_ptr<QuantLib::Quote>]’

QuantLib/quantlib_wrap.cpp:4663:   instantiated from ‘int swig::asptr(PyObject*, Type**) [with Type = std::vector<boost::shared_ptr<QuantLib::Quote>, std::allocator<boost::shared_ptr<QuantLib::Quote> > >]’

QuantLib/quantlib_wrap.cpp:43476:   instantiated from here
/opt/local/include/boost/assign/assignment_exception.hpp:24: error: ‘boost::assign’ is not a function,

QuantLib/quantlib_wrap.cpp:5558: error:   conflict with ‘template<class SwigPySeq, class Seq> void swig::assign(const SwigPySeq&, Seq*)’

QuantLib/quantlib_wrap.cpp:5585: error:   in call to ‘assign’

/opt/local/include/boost/assign/assignment_exception.hpp: In static member function ‘static int swig::traits_asptr_stdseq<Seq, T>::asptr(PyObject*, Seq**) [with Seq = std::vector<std::vector<boost::shared_ptr<QuantLib::Quote>, std::allocator<boost::shared_ptr<QuantLib::Quote> > >, std::allocator<std::vector<boost::shared_ptr<QuantLib::Quote>, std::allocator<boost::shared_ptr<QuantLib::Quote> > > > >, T = std::vector<boost::shared_ptr<QuantLib::Quote>, std::allocator<boost::shared_ptr<QuantLib::Quote> > >]’:

QuantLib/quantlib_wrap.cpp:5640:   instantiated from ‘static int swig::traits_asptr<std::vector<T, std::allocator<_CharT> > >::asptr(PyObject*, std::vector<T, std::allocator<_CharT> >**) [with T = std::vector<boost::shared_ptr<QuantLib::Quote>, std::allocator<boost::shared_ptr<QuantLib::Quote> > >]’

QuantLib/quantlib_wrap.cpp:4663:   instantiated from ‘int swig::asptr(PyObject*, Type**) [with Type = std::vector<std::vector<boost::shared_ptr<QuantLib::Quote>, std::allocator<boost::shared_ptr<QuantLib::Quote> > >, std::allocator<std::vector<boost::shared_ptr<QuantLib::Quote>, std::allocator<boost::shared_ptr<QuantLib::Quote> > > > >]’

QuantLib/quantlib_wrap.cpp:45813:   instantiated from here

/opt/local/include/boost/assign/assignment_exception.hpp:24: error: ‘boost::assign’ is not a function,

QuantLib/quantlib_wrap.cpp:5558: error:   conflict with ‘template<class SwigPySeq, class Seq> void swig::assign(const SwigPySeq&, Seq*)’

QuantLib/quantlib_wrap.cpp:5585: error:   in call to ‘assign’
/opt/local/include/boost/assign/assignment_exception.hpp: In static member function ‘static int swig::traits_asptr_stdseq<Seq, T>::asptr(PyObject*, Seq**) [with Seq = std::vector<boost::shared_ptr<QuantLib::StochasticProcess>, std::allocator<boost::shared_ptr<QuantLib::StochasticProcess> > >, T = boost::shared_ptr<QuantLib::StochasticProcess>]’:

QuantLib/quantlib_wrap.cpp:5640:   instantiated from ‘static int swig::traits_asptr<std::vector<T, std::allocator<_CharT> > >::asptr(PyObject*, std::vector<T, std::allocator<_CharT> >**) [with T = boost::shared_ptr<QuantLib::StochasticProcess>]’

QuantLib/quantlib_wrap.cpp:4663:   instantiated from ‘int swig::asptr(PyObject*, Type**) [with Type = std::vector<boost::shared_ptr<QuantLib::StochasticProcess>, std::allocator<boost::shared_ptr<QuantLib::StochasticProcess> > >]’

QuantLib/quantlib_wrap.cpp:124772:   instantiated from here
/opt/local/include/boost/assign/assignment_exception.hpp:24: error: ‘boost::assign’ is not a function,

QuantLib/quantlib_wrap.cpp:5558: error:   conflict with ‘template<class SwigPySeq, class Seq> void swig::assign(const SwigPySeq&, Seq*)’

QuantLib/quantlib_wrap.cpp:5585: error:   in call to ‘assign’

我尝试了几个版本的SWIG和Quantlib-SWIG,但似乎没有任何运气。我试过SWIG 3.0.6和3.0.2。Quantlib-SWIG 1.5和1.6。我的Quantlib版本是1.6,boost应该是最新的,因为我是从macports安装的。

我是不是遗漏了什么?

EN

回答 1

Stack Overflow用户

发布于 2015-09-15 10:57:50

这似乎是一个未指定命名空间的问题。添加命名空间后,它被正确编译。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/31331535

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档