我正在尝试安装并成功运行Bloomberg API
Python 3.5.5,我还下载并解压缩了C库3.8.1.1.,这两个版本都用于Mac OS X.我正在运行Mac OS X 10.10.2.我使用Python原生Mac OS X,Python 2.7.6,我已经通过Xcode安装了命令行gcc编译器GCC 4.2.1.
我在管理员帐户上做了sudo python setup.py install.我还将setup.py ENVIRONMENT变量BLPAPI_ROOT更改为C头的目录blpapi_cpp_3.8.1.1.设置成功.
我根据Python的README文件的建议改为另一个目录,以避免“导入错误:没有名为_internals的模块”.
当我去python并输入命令import blpapi时,我得到以下错误:
import blpapi
Traceback (most recent call last):
File “”, line 1, in
File “/Library/Python/2.7/site-packages/blpapi/init.py”, line 5, in
from .internals import CorrelationId
File “/Library/Python/2.7/site-packages/blpapi/internals.py”, line 50, in
_internals = swig_import_helper()
File “/Library/Python/2.7/site-packages/blpapi/internals.py”, line 46, in swig_import_helper
_mod = imp.load_module(‘_internals’, fp, pathname, description)
ImportError: dlopen(/Library/Python/2.7/site-packages/blpapi/_internals.so, 2): Library not loaded: libblpapi3_64.so
Referenced from: /Library/Python/2.7/site-packages/blpapi/_internals.so
Reason: image not found
我检查/Library/Python…/blpapi/的目录,并且没有_internals.so只有* .py文件.那是问题吗?我不知道该怎么办.
最佳答案 Python SDK自述文件中缺少一个步骤;它指示您设置BLPAPI_ROOT以构建API包装器,但是这不提供运行时所需的信息来加载它.
如果将C/C++ SDK解压缩到’/ home / foo / blpapi-sdk'(例如),则需要设置DYLD_LIBRARY_PATH以允许运行时动态链接器找到BLPAPI库.这可以这样做:
$export DYLD_LIBRARY_PATH = / home / foo / blpapi-sdk / Darwin