gpt4 book ai didi

python - python 版本 3.9 中的 blpapi

转载 作者:行者123 更新时间:2023-12-04 08:33:04 25 4
gpt4 key购买 nike

我正在尝试在 python 版本 3.9 中安装 blpapi

郑重声明,我能够使用标准设置并运行本页底部的 pip 命令使 3.7 和 3.8 正常工作:

www.bloomberg.com/professional/support/api-library

我需要做的唯一修改是:

对于 3.7 版:

py -3.7 -m pip install --index-url=https://bloomberg.bintray.com/pip/simple blpapi

对于 3.8 版:

py -3.8 -m pip install --index-url=https://bloomberg.bintray.com/pip/simple blpapi

我为 3.9 尝试了完全相同的方法,但这会引发错误:

py -3.9 -m pip install --index-url=https://bloomberg.bintray.com/pip/simple blpapi

这是错误:

Looking in indexes: https://bloomberg.bintray.com/pip/simple
Collecting blpapi
Downloading https://bloomberg.bintray.com/pip/simple/blpapi/blpapi-3.15.2.tar.gz (229 kB)
|████████████████████████████████| 229 kB 3.3 MB/s
ERROR: Command errored out with exit status 1:
command: 'C:\Python39\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\darren\\AppData\\Local\\Temp\\pip-install-ldwe3a4a\\blpapi\\setup.py'"'"'; __file__='"'"'C:\\Users\\darren\\AppData\\Local\\Temp\\pip-install-ldwe3a4a\\blpapi\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\darren\AppData\Local\Temp\pip-pip-egg-info-ehpqfebq'
cwd: C:\Users\darren\AppData\Local\Temp\pip-install-ldwe3a4a\blpapi\
Complete output (5 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\darren\AppData\Local\Temp\pip-install-ldwe3a4a\blpapi\setup.py", line 54, in <module>
assert blpapiRoot or (blpapiIncludesVar and blpapiLibVar), \
AssertionError: BLPAPI_ROOT (or BLPAPI_INCDIR/BLPAPI_LIBDIR) environment variable isn't defined
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

我尝试搜索针对 AssertionError: BLPAPI_ROOT (or BLPAPI_INCDIR/BLPAPI_LIBDIR) environment variable isn't defined 的解决方案,但没有找到任何有效的解决方案,此时我被卡住了。

这是我的基本代码:

import os
import sys
#import xbbg

# check python version
if sys.version_info.major == 3:
if sys.version_info.minor == 7:
print('using version: 3.7')
import blpapi

if sys.version_info.major == 3:
if sys.version_info.minor == 8:
print('using version: 3.8')
with os.add_dll_directory('c:/blp/DAPI'):
import blpapi


if sys.version_info >= (3,9):
print('using version: 3.9')
print('version 3.9 and above not working')
sys.exit(0) # i added this to exit before the error message for v 3.9
with os.add_dll_directory('c:/blp/DAPI'):
import blpapi




x = 'hello world'
print(x)

谁能解决这个问题?

(最好让 blpapi 适用于所有版本)。

最佳答案

似乎现在支持它,而在撰写问题时它不支持:

We support and provide wheels for Python 2.7, 3.6, 3.7, 3.8 and 3.9; Both 32 and 64 bits, for Windows, macOS, and most versions of Linux. These wheels now come bundled with the required C++ API, and a separate C++ API installation is no longer required.

链接在这里: https://www.bloomberg.com/professional/support/api-library/

关于python - python 版本 3.9 中的 blpapi,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64934242/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com