无法在 Windows 中的 Python 中导入 pyrfc

问题描述

我正在尝试通过调用功能模块 RFC_READ_TABLE 将 python 连接到 SAP。我遵循了 this link 中的每个步骤,包括设置环境变量。

enter image description here

但是,当我尝试导入 Pyrfc 时,出现错误:ImportError: DLL load failed while importing _pyrfc: The specified procedure could not be found.

enter image description here

如果我在 CMD Consule 中手动设置 PATH=C:\nwrfcsdk\lib;C:\nwrfcsdk\bin;%PATH%,它工作正常,

enter image description here

enter image description here

我已经多次重启我的电脑。还是一样的问题。 有人可以帮助我吗?谢谢。

解决方法

很可能您下载了错误版本的 PyRFC,这就是它在路径中找不到它的原因:

https://github.com/SAP/PyRFC/issues/152

enter image description here

最近我陷入了这个陷阱,并试图找出我的机器上无法识别 NWRFC/PyRFC 的原因

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...