2015-07-10 224 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