python 版本 3.9 中的 blpapi
blpapi in python version 3.9
我正在尝试在 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
适用于所有版本)。
根据 blapi 文档,预构建二进制文件仅适用于 Python 3.8 及以下版本。
错误是因为您强制pip
为Python版本3.9安装blapi binaries
,该版本尚不可用或尚未发布。pip
将下载并安装最新的 blapi binaries
如果没有指定版本。
即)python -m pip install --index-url=https://bloomberg.bintray.com/pip/simple 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.
link 在这里:
https://www.bloomberg.com/professional/support/api-library/
我正在尝试在 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
适用于所有版本)。
根据 blapi 文档,预构建二进制文件仅适用于 Python 3.8 及以下版本。
错误是因为您强制pip
为Python版本3.9安装blapi binaries
,该版本尚不可用或尚未发布。pip
将下载并安装最新的 blapi binaries
如果没有指定版本。
即)python -m pip install --index-url=https://bloomberg.bintray.com/pip/simple 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.
link 在这里: https://www.bloomberg.com/professional/support/api-library/