我正在尝试开发一个使用 Microsoft azure 实现 IoT 的 python 控制台应用程序。为此,我关注very basic tutorial made for python developers by Microsoft azure在我的 Windows 10 计算机上。预装Visual C++ redistributable package是本教程简介部分中描述的 4 个先决条件中允许使用 Python 原生 DLL 的最重要要求之一。
我的系统配置:
Software Version
-------------------------------------------------------
Python: 3.5.2
Visual C++ redistributable package: 2010, 2013, 2017
Node: 6.10.2
问题:
- 自 Visual C++ redistributable package 起未安装 Visual C++ 可再发行组件包教程中是旧版本(2015),然后是我的版本(2017)。
它显示以下错误:
Traceback (most recent call last): File "CreateDeviceIdentity.py", line 2, in <module> import iothub_service_client File "F:\Settings\Windows\ProgramFiles\Python\lib\site-packages\iothub_service_client\__init__.py", line 1, in <module> from .iothub_service_client import * ImportError: DLL load failed: The specified module could not be found.
问题:
- 我该如何解决这个问题?
注意:我已经完成了为 Java 和 NodeJS 开发人员提供的基础教程。
最佳答案
我尝试成功重现您的问题,并且我使代码 import iothub_service_client
在安装后有效 Visual C++ Redistributable for Visual Studio 2015 。所以请在你的机器上安装2015版本来解决它,正如教程所说,
If you are using Windows OS, then Visual C++ redistributable package to allow the use of native DLLs from Python.
教程中的链接适用于 2015 版本。
关于python - 面临导入错误: DLL load failed while implementing Microsoft azure iothub_service_client,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44712900/