我一直在尝试让 pdblp 或 pybbg 在 python 中工作。我已经blpapi
通过安装pip
,并下载了实验性 c++ 版本并将其添加到我的 PATH 环境变量中。运行以下代码时,我收到 pdblp 的此错误
使用 Anaconda3 64 位,python 3.7,最新的 blp_cpp 实验版本(cpp_3.12.3.1),pip install 是版本 3.12.2。计算机正在使用 Windows 10:
import blpapi
import pdblp
Traceback (most recent call last):
File "<ipython-input-2-af8ae6f76dae>", line 1, in <module>
import pdblp
File "C:\ProgramData\Anaconda3\lib\site-packages\pdblp\__init__.py", line 1, in <module>
from .pdblp import BCon # NOQA
File "C:\ProgramData\Anaconda3\lib\site-packages\pdblp\pdblp.py", line 9, in <module>
_RESPONSE_TYPES = [blpapi.Event.RESPONSE, blpapi.Event.PARTIAL_RESPONSE]
AttributeError: module 'blpapi' has no attribute 'Event'
pybbg的这个错误:
import pandas as pd
import numpy as np
import blpapi
import pybbg as pybbg
bb = pybbg.Pybbg()
runfile('C:/Python/BB.py', wdir='C:/Python')
Reloaded modules: pybbg, pybbg.pybbg_k
Traceback (most recent call last):
File "<ipython-input-4-b339dc11b877>", line 1, in <module>
runfile('C:/Python/BB.py', wdir='C:/Python')
File "C:\ProgramData\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 704, in runfile
execfile(filename, namespace)
File "C:\ProgramData\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 108, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)
File "C:\Python\BB.py", line 14, in <module>
bb = pybbg.Pybbg()
File "C:\Python\PYTHONPATH\pybbg\pybbg_k.py", line 27, in __init__
sessionOptions = blpapi.SessionOptions()
AttributeError: module 'blpapi' has no attribute 'SessionOptions'
对此的任何帮助将不胜感激。