Python 2.7 with Bloomberg API import blpapi failure

前端 未结 3 1201
失恋的感觉
失恋的感觉 2020-12-20 18:03

This is my development environment:

  • Windows 7 on a 64-bit HP Pavilion laptop
  • Python 2.7, 32-bit in folder C:\\python27
  • Development environmen
3条回答
  •  悲哀的现实
    2020-12-20 18:54

    Note this article, from Bloomberg:

    In order for python scripts to call Bloomberg API functions, the libraries distributed as part of the Bloomberg C++ SDK must be available to the Python interpreter. Step 3 of installation, above, provides system-wide installation of this library. Linux/Solaris/*nix users without system-wide installations must set the LD_LIBRARY_PATH (or DYLD_LIBRARY_PATH on Darwin/MacOS X) environment variable to include the directory containing the blpapi3 shared libraries. Windows users may need to set the PATH variable to the directory containing blpapi3_32.dll or blpapi3_64.dll. (Note that Windows users with the Bloomberg Terminal software installed already have versions of these libraries in their PATH.)

    So what I did (very similarly to Keng Onn's answer) was:

    1. Download the C/C++ lib for Windows

    2. Extract files from blpapi_cpp_3.8.8.1.zip (or similar)

    3. Copy blpapi3_32.dll from the bin folder and paste it anywhere safe

    In my case, I pasted it into C:\Python27\Lib\site-packages\blpapi

    1. Add this route to your Path environment variable

      • Click "Start" / Right-click "Computer" / Properties / Advanced System Settings / Advanced tab / Environment Variables

      • Double click "Path" under "System variables" list

      • Add a semicolon (;) and your path as seen below

    For me: C:\Python27\Lib\site-packages\blpapi

    enter image description here

    Now it should work just fine for you. Hope it helps.

提交回复
热议问题