尝试使用Bloomberg python API设置PC。我遵循了说明的每个步骤,但是当我最终尝试“导入blpapi”时,始终会遇到问题。下面是日志。任何帮助将不胜感激。
在在线研究了数小时后,我已经执行了以下步骤:

  • 将最新的c++ api安装到c:\ blp \ cppapi目录
  • 将c:\ blp \ cppapi \ lib,c \ blp \ cppapi \ bin和c:\ blp \ cppapi添加到了
  • 路径
  • 将en BLPAPI_ROOT设置为c:\ blp \ cppapi
  • 我什至重新安装了Bloomberg。

  • 不过,我总是遇到相同的错误。看来我无法使python进入硬盘驱动器上的c++ API目录...
    提前致谢!
    C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools>python
    Python 3.8.5 (tags/v3.8.5:580fbb0, Jul 20 2020, 15:57:54) [MSC v.1924 64 bit (AMD64)] on win32
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import blpapi
    Traceback (most recent call last):
      File "C:\Users\frank\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\blpapi\internals.py", line 39, in swig_import_helper
        return importlib.import_module(mname)
      File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1520.0_x64__qbz5n2kfra8p0\lib\importlib\__init__.py", line 127, in import_module
        return _bootstrap._gcd_import(name[level:], package, level)
      File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
      File "<frozen importlib._bootstrap>", line 991, in _find_and_load
      File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
    ModuleNotFoundError: No module named 'blpapi._internals'
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "C:\Users\frank\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\blpapi\__init__.py", line 6, in <module>
        from .internals import CorrelationId
      File "C:\Users\frank\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\blpapi\internals.py", line 42, in <module>
        _internals = swig_import_helper()
      File "C:\Users\frank\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\blpapi\internals.py", line 41, in swig_import_helper
        return importlib.import_module('_internals')
      File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1520.0_x64__qbz5n2kfra8p0\lib\importlib\__init__.py", line 127, in import_module
        return _bootstrap._gcd_import(name[level:], package, level)
    ModuleNotFoundError: No module named '_internals'
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "C:\Users\frank\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\blpapi\__init__.py", line 11, in <module>
        raise debug_load_error(error)
    ImportError:
    ---------------------------- ENVIRONMENT -----------------------------
    Platform: Windows-10-10.0.18362-SP0
    Architecture: ('64bit', 'WindowsPE')
    Python: 3.8.5 (tags/v3.8.5:580fbb0, Jul 20 2020, 15:57:54) [MSC v.1924 64 bit (AMD64)]
    Python implementation: CPython
    
    blpapi 64-bit will be loaded from: "C:\blp\cppapi\bin\blpapi3_64.dll"
    blpapi 32-bit will be loaded from: "C:\blp\cppapi\bin\blpapi3_32.dll"
    System PATH: (* marks locations where blpapi was found)
        "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\bin\HostX86\x86"
        "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\IDE\CommonExtensions\Microsoft\TestWindow"
        "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\bin\Roslyn"
        "C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x86"
        "C:\Program Files (x86)\Windows Kits\10\bin\x86"
        "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\\MSBuild\15.0\bin"
        "C:\Windows\Microsoft.NET\Framework\v4.0.30319"
        "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\IDE\"
        "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\Tools\"
        "C:\Program Files (x86)\Common Files\Oracle\Java\javapath"
        "C:\WINDOWS\system32"
        "C:\WINDOWS"
        "C:\WINDOWS\System32\Wbem"
        "C:\blp\cppapi"
      * "C:\blp\cppapi\bin"
      * "C:\blp\cppapi\lib"
        "C:\WINDOWS\System32\WindowsPowerShell\v1.0\"
        "C:\WINDOWS\System32\OpenSSH\"
        "C:\Program Files (x86)\AOMEI Backupper"
      * "C:\blp\DAPI"
        "C:\Users\frank\AppData\Local\Microsoft\WindowsApps"
        "C:\blp\cppapi"
      * "C:\blp\cppapi\bin"
      * "C:\blp\cppapi\lib"
      * "C:\blp\DAPI"
        "C:\blp\DAPI\DDE"
        "C:\Program Files\JetBrains\PyCharm Community Edition 2020.2.1\bin"
        "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin"
        "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\IDE\CommonExtensions\Microsoft\CMake\Ninja"
    
    blpapi package at: "C:\Users\frank\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages"
    
    Current directory: "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools"
    
    ----------------------------------------------------------------------
    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.
    >>>
    

    最佳答案

    很高兴地报告此问题已解决。
    原来,我正在运行 Python 3.8 ,尚不支持。我必须降级到 3.7.9 ,并切换到C++ SDK的“实验版本”,才能正常工作。
    希望这也可以帮助其他为此付出努力的人。

    07-24 22:22