0

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

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

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,当我从 macports 安装时,boost 应该是最新的。

有什么我想念的吗?

4

1 回答 1

0

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

于 2015-09-15T02:57:49.747 回答