2015-07-10 179 views
0

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

我能够按照http://quantlib.org/install/macosx.shtml(如果有问题,我在Lion上)的程序成功地构建Quantlib并运行所有测试套件。我下载并解压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’ 

我想痛饮一对夫妇版本Quantlib-SWIG似乎没有任何运气。我试过SWIG 3.0.6和3.0.2。 Quantlib-SWIG 1.5和1.6。我的Quantlib版本是1.6,并且从macports安装时应该是最新版本。

有什么我失踪?

+0

看起来您并不是唯一一个遇到这个问题的人:请参阅https://dev.lsstcorp.org/trac/ticket/1249获取与QuantLib无关的类似报告。不过,这是我第一次听说它。你可以检查你使用的是什么版本的Boost吗?您应该在中找到信息。 –

+0

#define BOOST_VERSION 105800 – Wesley

+0

所以这是最新的一个。只是为了排除它在SWIG安装上的某些问题,您是否可以尝试发布的QuantLib-SWIG 1.6并使用包含的文件而不运行SWIG?另外,你使用的是什么编译器版本? –

回答

0

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

+0

这不提供问题的答案。要批评或要求作者澄清,在他们的帖子下留下评论 - 你总是可以评论你自己的帖子,一旦你有足够的[声誉](http://stackoverflow.com/help/whats-reputation),你会能够[评论任何帖子](http://stackoverflow.com/help/privileges/comment)。 – Suresh

+0

不幸的是,我不记得我到底做了什么,并且已经卸载它,因为我又走了另一个方向。我想/需要确保人们不再花时间回答不再需要回答的事情。但是因为有一个解决方法,即使对于那些查询和查找这篇文章的人来说,这也是很有帮助的。 – Wesley