【问题标题】:Unable to import blpapi无法导入 blpapi
【发布时间】:2020-10-27 21:44:13
【问题描述】:

我几乎花了很多时间来尝试让bloomberg API 与我的Python 2.7 安装一起工作,但仍然没有运气。 Bloomberg HelpDesk 不再支持它,因此他们无法提供帮助。非常感谢任何帮助:

C:\Users\user>python
Python 2.7.16rc1 (v2.7.16rc1:baacaac06f, Feb 16 2019, 22:56:10) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import blpapi
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27\lib\site-packages\blpapi\__init__.py", line 11, in <module>
    raise debug_load_error(error)
ImportError:
---------------------------- ENVIRONMENT -----------------------------
Platform: Windows-7-6.1.7601-SP1
Architecture: ('64bit', 'WindowsPE')
Python: 2.7.16rc1 (v2.7.16rc1:baacaac06f, Feb 16 2019, 22:56:10) [MSC v.1500 64 bit (AMD64)]
Python implementation: CPython

blpapi 64-bit will be loaded from: "C:\blp\blpapi_cpp_3.12.3.1\bin\blpapi3_64.dll"
blpapi 32-bit will be loaded from: "C:\blp\blpapi_cpp_3.12.3.1\bin\blpapi3_32.dll"
System PATH: (* marks locations where blpapi was found)
    "C:\Program Files\Java\jdk-12.0.2\bin"
    "C:\Python27\"
    "C:\Python27\Scripts"
    "C:\Windows\system32"
    "C:\Windows"
    "C:\Windows\System32\Wbem"
    "C:\Windows\System32\WindowsPowerShell\v1.0\"
  * "C:\blp\blpapi_cpp_3.12.3.1\bin"

blpapi package at: "C:\Python27\lib\site-packages"

Current directory: "C:\Users\user"

----------------------------------------------------------------------
No module named _versionhelper

Could not open the C++ SDK library.

Download and install the latest C++ SDK from:

    http://www.bloomberg.com/professional/api-library

If the C++ SDK is already installed, please ensure that the path to the library
was added to PATH before entering the interpreter.

【问题讨论】:

  • 您的机器上是否有与*_versionhelper* 匹配的文件?当你说 Bloomberg 不再支持这个时,你的意思是因为他们现在需要 Python 3?
  • 互联网上的一些搜索表明 _versionhelper 错误是由于 python API 和 C++ 安装版本不匹配。我尝试了一些排列。彭博帮助台不支持 Python API(WAPI 产品)。他们有一个新产品,你可以在终端内运行 jupyter notebook。原因之一是不鼓励人们在他们的系统上从彭博下载数据。
  • 你用的是哪个版本的python blpapi包?为什么彭博帮助台不能为您提供支持?
  • bloomberg 帮助台已停止支持 python

标签: python-2.7 bloomberg blpapi


【解决方案1】:

此问题通常与由于环境变量设置不当而无法找到共享库有关。我会看看通过Conda 安装它。试试

conda install -c conda-forge blpapi

只要确保您感兴趣的任何 python 发行版都打包在 conda 上,正如 here 所讨论的那样。

【讨论】:

    【解决方案2】:

    我做了两件事来解决类似的问题:

    1- 我安装了 Microsoft Visual Studio,确保我有以下组件:

    • C++/CLI 支持
    • VC++ 2015.3 v14.00 (v140) 桌面工具集
    • 适用于 x86 和 x64 的 Visual C++ MFC
    • 适用于 x86 和 x64 的 Visual C++ ATL

    2- 我手动将 C++API\lib 中的 .dll 文件(在我的例子中为 blpapi3_32.dll 和 blpapi3_64.dll)复制到系统使用的所有 dll 文件所在的 C:\windows\system32 中。

    另外,我将 C++API\lib 中的 dll 文件复制到 C:\blp\DAPI 中,用旧的替换新的。

    不知何故,Path 变量不够成功,无法在 API 文件夹中找到 dll。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-08-10
      • 1970-01-01
      • 2021-11-20
      • 2017-01-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多