我目前使用的是 Python 2.7,我的操作系统是 Windows 7。在尝试使用 Bloomberg API 时,我收到了这个错误:
Traceback (most recent call last):
File "datagrab.py", line 1, in <module>
import blpapi, time, json
File "C:\Python27\lib\blpapi\__init__.py", line 5, in <module>
from .internals import CorrelationId
File "C:\Python27\lib\blpapi\internals.py", line 50, in <module>
_internals = swig_import_helper()
File "C:\Python27\lib\blpapi\internals.py", line 42, in swig_import_helper
import _internals
ImportError: No module named _internals
我已将路径变量设置为指向 blpapi3_64.dll 并更新了我的彭博终端。我还将本地 blpapi API 移动到不同的目录,但问题仍然存在。
一般来说,我对这个 API 有点陌生。那么有人可以指导我吗?
先感谢您!
最佳答案
从您的问题看来,您可能已经尝试过了,但只是从 README
中概述了一种可能的解决方案。在 Python Supported Release
发布可用here .
Note that many Python installations add the current directory to the module search path. If the Python interpreter is invoked from the installer directory, such a configuration will attempt to use the (incomplete) local
blpapi
directory as a module. If the aboveimport
line fails with the messageImport Error: No module named _internals
, move to a different directory before invokingpython
.
关于python-2.7 - 使用 Bloomberg API 时没有出现名为 _internals 的模块错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48908416/