我正试图在PyRFC的帮助下将SAP与python连接起来。我指的是建立连接的本指南https://blogs.sap.com/2020/06/09/connecting-python-with-sap-step-by-step-guide/。但是,我无法在我的系统中安装PyRFC。我已经维护了本文中定义的系统变量,在尝试安装PyRFC.tar.gz文件之后,它将显示
ERROR: Command errored out with exit status 1:
command: 'c:\users\20035128\appdata\local\programs\python\python37\python.exe' -c
'import sys, setuptools, tokenize; sys.argv[0] =
'"'"'C:\\Users\\20035128\\AppData\\Local\\Temp\\pip-req-build-4ouyveyv\\setup.py'"'"';
__file__='"'"'C:\\Users\\20035128\\AppData\\Local\\Temp\\pip-req-build-4ouy
veyv\\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\20035128\AppData\Local\Temp\pip-pip-egg-info-fwk_dg_0'
cwd: C:\Users\20035128\AppData\Local\Temp\pip-req-build-4ouyveyv\
Complete output (1 lines):
Environment variable SAPNWRFC_HOME not set. Please specify this variable with the root
directory of the SAP NW RFC Library.
----------------------------------------
WARNING: Discarding file:///C:/Users/20035128/Downloads/PyRFC-2.0.4.tar.gz. Command errored
out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for
full command output.
请帮我处理这个。
发布于 2021-02-25 15:42:51
您得到此错误的原因可能是您没有下载SAP,或者您没有在path变量中添加SDK的路径。
运行pip install pyrfc
之前,请按照以下步骤操作
下载SDK
https://support.sap.com/en/product/connectors/nwrfcsdk.html
创建SAP主目录,例如c:\nwrfcsdk
SAPNWRFC_HOME=c:\nwrfcsdk
c:\nwrfcsdk\lib
应该存在。例如-将c:\nwrfcsdk\lib
添加到PATH。
从这个URL - https://github.com/SAP/PyRFC/releases/download/2.0.0/pyrfc-2.0.0-cp38-cp38-win_amd64.whl下载.whl
文件
通过从下载Administrator文件的文件夹位置以形式运行
命令- pip install pyrfc-2.0.0-cp38-cp38-win_amd64.whl
如果您按照给定的顺序执行了上述步骤,那么它现在应该可以工作了。
参考资料:https://sap.github.io/PyRFC/install.html
我之前遇到了一个类似的问题,并以类似的方式解决了这个问题。
这是我的问题- Python - pyrfc 1.9.5 - importerror while calling from IIS hosted .NET Core api
https://stackoverflow.com/questions/66368467
复制相似问题