导入pyql命名空间的错误

时间:2016-04-16 01:27:14

标签: python-2.7 python-import quantlib

我可以导入很多东西,如下面的代码所示,但是如果我取消注释已注释掉的两个导入,我会收到错误

[idf@node1 cboe]$ python pandas_pyql.py 
Traceback (most recent call last):
  File "pandas_pyql.py", line 33, in <module>
    from quantlib.instruments.api import EuropeanOption
  File "/home/idf/anaconda/lib/python2.7/site-packages/quantlib-0.1-py2.7-linux-x86_64.egg/quantlib/instruments/api.py", line 1, in <module>
    from .bonds import FixedRateBond, ZeroCouponBond
  File "quantlib/indexes/ibor_index.pxd", line 12, in init quantlib.instruments.bonds (quantlib/instruments/bonds.cpp:6651)
ImportError: /home/idf/anaconda/lib/python2.7/site-packages/quantlib-0.1-py2.7-linux-x86_64.egg/quantlib/indexes/ibor_index.so: undefined symbol: _ZNK8QuantLib9IborIndex21businessDayConventionEv
[idf@node1 cboe]$ 

[idf@node1 cboe]$ python pandas_pyql.py 
Traceback (most recent call last):
  File "pandas_pyql.py", line 36, in <module>
    from quantlib.termstructures.yields.api import FlatForward
  File "/home/idf/anaconda/lib/python2.7/site-packages/quantlib-0.1-py2.7-linux-x86_64.egg/quantlib/termstructures/yields/api.py", line 1, in <module>
    from .bond_helpers import BondHelper, FixedRateBondHelper
  File "quantlib/termstructures/yields/bond_helpers.pyx", line 1, in init quantlib.termstructures.yields.bond_helpers (quantlib/termstructures/yields/bond_helpers.cpp:4617)
ImportError: /home/idf/anaconda/lib/python2.7/site-packages/quantlib-0.1-py2.7-linux-x86_64.egg/quantlib/termstructures/yields/rate_helpers.so: undefined symbol: _ZN8QuantLib14SwapRateHelperC1ERKNS_6HandleINS_5QuoteEEERKNS_6PeriodERKNS_8CalendarENS_9FrequencyENS_21BusinessDayConventionERKNS_10DayCounterERKN5boost10shared_ptrINS_9IborIndexEEES5_S8_RKNS1_INS_18YieldTermStructureEEE
[idf@node1 cboe]$ 


import quantlib.reference.names as nm
from quantlib.pricingengines.blackformula import blackFormulaImpliedStdDev


from quantlib.instruments.option import EuropeanExercise, VanillaOption
from quantlib.instruments.payoffs import PlainVanillaPayoff, Put, Call
from quantlib.models.equity.heston_model import HestonModel
from quantlib.pricingengines.vanilla.vanilla import AnalyticHestonEngine
from quantlib.processes.heston_process import HestonProcess
from quantlib.quotes import SimpleQuote
from quantlib.settings import Settings
from quantlib.util.converter import pydate_to_qldate, df_to_zero_curve

#from quantlib.instruments.api import EuropeanOption
from quantlib.pricingengines.api import AnalyticEuropeanEngine
from quantlib.processes.api import BlackScholesMertonProcess
#from quantlib.termstructures.yields.api import FlatForward
from quantlib.termstructures.volatility.api import BlackConstantVol
from quantlib.time.api import today, NullCalendar, ActualActual

from quantlib.time.date import (Period, Days)
from quantlib.mlab.util import common_shape, array_call

编辑1

这是我的/ usr / local / lib

lrwxrwxrwx.  1 root root         16 Apr 24  2015 libczmq.so -> libczmq.so.1.1.0
lrwxrwxrwx.  1 root root         16 Apr 24  2015 libczmq.so.1 -> libczmq.so.1.1.0
-rwxr-xr-x.  1 root root     780174 Apr 24  2015 libczmq.so.1.1.0
-rwxr-xr-x.  1 root root        927 Apr 24  2015 libfix8.la
lrwxrwxrwx.  1 root root         16 Apr 24  2015 libfix8.so -> libfix8.so.1.0.3
lrwxrwxrwx.  1 root root         16 Apr 24  2015 libfix8.so.1 -> libfix8.so.1.0.3
-rwxr-xr-x.  1 root root    7784908 Apr 24  2015 libfix8.so.1.0.3
lrwxrwxrwx   1 root root         19 Jul 17  2015 libgdiplus.so -> libgdiplus.so.0.0.0
lrwxrwxrwx   1 root root         19 Jul 17  2015 libgdiplus.so.0 -> libgdiplus.so.0.0.0
-rwxr-xr-x   1 root root     424120 Mar  9  2015 libgdiplus.so.0.0.0
-rwxr-xr-x.  1 root root        939 Apr 24  2015 libhftest.la
lrwxrwxrwx.  1 root root         18 Apr 24  2015 libhftest.so -> libhftest.so.0.0.0
lrwxrwxrwx.  1 root root         18 Apr 24  2015 libhftest.so.0 -> libhftest.so.0.0.0
-rwxr-xr-x.  1 root root    2834313 Apr 24  2015 libhftest.so.0.0.0
-rwxr-xr-x.  1 root root     209608 Apr 24  2015 libkj-0.6-dev.so
-rw-r--r--.  1 root root     334352 Apr 24  2015 libkj.a
-rwxr-xr-x.  1 root root     359914 Apr 24  2015 libkj-async-0.6-dev.so
-rw-r--r--.  1 root root     528718 Apr 24  2015 libkj-async.a
-rwxr-xr-x.  1 root root       1002 Apr 24  2015 libkj-async.la
lrwxrwxrwx.  1 root root         22 Apr 24  2015 libkj-async.so -> libkj-async-0.6-dev.so
-rwxr-xr-x.  1 root root        936 Apr 24  2015 libkj.la
lrwxrwxrwx.  1 root root         16 Apr 24  2015 libkj.so -> libkj-0.6-dev.so
-rwxr-xr-x.  1 root root      57925 Apr 24  2015 libkj-test-0.6-dev.so
-rw-r--r--.  1 root root      71578 Apr 24  2015 libkj-test.a
-rwxr-xr-x.  1 root root        995 Apr 24  2015 libkj-test.la
lrwxrwxrwx.  1 root root         21 Apr 24  2015 libkj-test.so -> libkj-test-0.6-dev.so
-rw-r--r--   1 root root     550804 Jul  3  2015 libpfring.a
-rwxr-xr-x   1 root root     421488 Jul  3  2015 libpfring.so
lrwxrwxrwx.  1 root root         24 Apr 24  2015 libPocoFoundationd.so -> libPocoFoundationd.so.30
-rwxr-xr-x.  1 root root   10145915 Apr 24  2015 libPocoFoundationd.so.30
lrwxrwxrwx.  1 root root         23 Apr 24  2015 libPocoFoundation.so -> libPocoFoundation.so.30
-rwxr-xr-x.  1 root root    2006896 Apr 24  2015 libPocoFoundation.so.30
lrwxrwxrwx.  1 root root         18 Apr 24  2015 libPocoJSONd.so -> libPocoJSONd.so.30
-rwxr-xr-x.  1 root root    2318379 Apr 24  2015 libPocoJSONd.so.30
lrwxrwxrwx.  1 root root         17 Apr 24  2015 libPocoJSON.so -> libPocoJSON.so.30
-rwxr-xr-x.  1 root root     327936 Apr 24  2015 libPocoJSON.so.30
lrwxrwxrwx.  1 root root         17 Apr 24  2015 libPocoNetd.so -> libPocoNetd.so.30
-rwxr-xr-x.  1 root root    7169896 Apr 24  2015 libPocoNetd.so.30
lrwxrwxrwx.  1 root root         16 Apr 24  2015 libPocoNet.so -> libPocoNet.so.30
-rwxr-xr-x.  1 root root    1209648 Apr 24  2015 libPocoNet.so.30
lrwxrwxrwx.  1 root root         18 Apr 24  2015 libPocoUtild.so -> libPocoUtild.so.30
-rwxr-xr-x.  1 root root    3264471 Apr 24  2015 libPocoUtild.so.30
lrwxrwxrwx.  1 root root         17 Apr 24  2015 libPocoUtil.so -> libPocoUtil.so.30
-rwxr-xr-x.  1 root root     473760 Apr 24  2015 libPocoUtil.so.30
lrwxrwxrwx.  1 root root         17 Apr 24  2015 libPocoXMLd.so -> libPocoXMLd.so.30
-rwxr-xr-x.  1 root root    2927891 Apr 24  2015 libPocoXMLd.so.30
lrwxrwxrwx.  1 root root         16 Apr 24  2015 libPocoXML.so -> libPocoXML.so.30
-rwxr-xr-x.  1 root root     596408 Apr 24  2015 libPocoXML.so.30
-rw-r--r--   1 root root   54723484 Mar 27 13:42 libprotobuf.a
-rwxr-xr-x   1 root root        972 Mar 27 13:42 libprotobuf.la
-rw-r--r--   1 root root    4638676 Mar 27 13:42 libprotobuf-lite.a
-rwxr-xr-x   1 root root       1007 Mar 27 13:42 libprotobuf-lite.la
lrwxrwxrwx   1 root root         26 Mar 27 13:42 libprotobuf-lite.so -> libprotobuf-lite.so.10.0.0
lrwxrwxrwx   1 root root         26 Mar 27 13:42 libprotobuf-lite.so.10 -> libprotobuf-lite.so.10.0.0
-rwxr-xr-x   1 root root    2005147 Mar 27 13:42 libprotobuf-lite.so.10.0.0
lrwxrwxrwx   1 root root         21 Mar 27 13:42 libprotobuf.so -> libprotobuf.so.10.0.0
lrwxrwxrwx   1 root root         21 Mar 27 13:42 libprotobuf.so.10 -> libprotobuf.so.10.0.0
-rwxr-xr-x   1 root root   21758102 Mar 27 13:42 libprotobuf.so.10.0.0
-rw-r--r--   1 root root   96605238 Mar 27 13:42 libprotoc.a
-rwxr-xr-x   1 root root        988 Mar 27 13:42 libprotoc.la
lrwxrwxrwx   1 root root         19 Mar 27 13:42 libprotoc.so -> libprotoc.so.10.0.0
lrwxrwxrwx   1 root root         19 Mar 27 13:42 libprotoc.so.10 -> libprotoc.so.10.0.0
-rwxr-xr-x   1 root root   32484516 Mar 27 13:42 libprotoc.so.10.0.0
-rw-r--r--   1 root root 1025743748 Jun 12  2015 libQuantLib.a
-rwxr-xr-x   1 root root        945 Jun 12  2015 libQuantLib.la
lrwxrwxrwx   1 root root         20 Jun 12  2015 libQuantLib.so -> libQuantLib.so.0.0.0
lrwxrwxrwx   1 root root         20 Jun 12  2015 libQuantLib.so.0 -> libQuantLib.so.0.0.0
-rwxr-xr-x   1 root root  365069474 Jun 12  2015 libQuantLib.so.0.0.0

这是我的LD_LIBRARY_PATH

[idf@node1 cboe]$ echo $LD_LIBRARY_PATH
/opt/intel/lib/intel64:/opt/NAG/cll6i25dcl/lib:/usr/lib64:/usr/lib64/openmpi/lib:/usr/local/lib:/opt/intel/opencl/lib64:/usr/local/apr/lib:
[idf@node1 cboe]$ 

0 个答案:

没有答案