QuantLib没有使用日内支持进行编译

时间:2018-02-05 06:20:29

标签: python python-3.6 quantlib quantlib-swig

在Mac 10.12.6上编译了QuantLib v1.11,其中包含启用了日内支持的文档中的标准选项

./configure --with-boost-include=/usr/local/include/ \
            --with-boost-lib=/usr/local/lib/ --prefix=/usr/local/ \
            CXXFLAGS='-O2 -stdlib=libc++ -mmacosx-version-min=10.9' \
            LDFLAGS='-stdlib=libc++ -mmacosx-version-min=10.9' \
            --enable-intraday

为Anaconda Python 3.6.2安装了QuantLib:

pip install QuantLib-Python

尝试创建失败的日内ql.Date对象:

>>> import QuantLib as ql
>>> import datetime as dt
>>> now = dt.datetime.today()
>>> ql.Date(now.day, now.month, now.year, now.hour, now.minute, now.second)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/jason/anaconda3/lib/python3.6/site-packages/QuantLib/QuantLib.py", line 433, in __init__
    this = _QuantLib.new_Date(*args)
RuntimeError: QuantLib was not compiled with intraday support

这是一个错误还是我做错了什么?

(Cross GitHub

1 个答案:

答案 0 :(得分:1)

使用pip安装的QuantLib-Python版本附带了自己的库静态版本,并且没有链接到您编译的版本。如果你想使用后者,你必须自己编译包装器。