python - ModuleNotFoundError:没有名为“azure”的模块
问题描述
我正在尝试在我的 Windows 开发机器上运行此示例代码。当我尝试运行simple_send_message.py时,我收到以下错误消息
Traceback (most recent call last):
File "msg.py", line 3, in <module>
from azure.iot.device.aio import IoTHubDeviceClient
ModuleNotFoundError: No module named 'azure'
开发环境详细信息
PS C:\data\code\youtube\iothub\python-send-message> py --version
Python 3.8.5
PS C:\data\code\youtube\iothub\python-send-message>pip install azure-iot-device
Requirement already satisfied: azure-iot-device in c:\users\heman\appdata\local\programs\python\python37-32\lib\site-packages (2.1.4)
Requirement already satisfied: PySocks in c:\users\heman\appdata\local\programs\python\python37-32\lib\site-packages (from azure-iot-device) (1.7.1)
Requirement already satisfied: six<2.0.0,>=1.12.0 in c:\users\heman\appdata\local\programs\python\python37-32\lib\site-packages (from azure-iot-device) (1.15.0)
Requirement already satisfied: paho-mqtt<2.0.0,>=1.4.0 in c:\users\heman\appdata\local\programs\python\python37-32\lib\site-packages (from azure-iot-device) (1.5.0)
Requirement already satisfied: requests-unixsocket<1.0.0,>=0.1.5 in c:\users\heman\appdata\local\programs\python\python37-32\lib\site-packages (from azure-iot-device) (0.2.0)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>1.21.1; python_version != "3.4" in c:\users\heman\appdata\roaming\python\python37\site-packages (from azure-iot-device) (1.24.2)
Requirement already satisfied: requests<3.0.0,>=2.20.0 in c:\users\heman\appdata\roaming\python\python37\site-packages (from azure-iot-device) (2.21.0)
Requirement already satisfied: janus==0.4.0; python_version >= "3.5" in c:\users\heman\appdata\local\programs\python\python37-32\lib\site-packages (from azure-iot-device) (0.4.0)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\heman\appdata\roaming\python\python37\site-packages (from requests<3.0.0,>=2.20.0->azure-iot-device) (2019.3.9)
Requirement already satisfied: idna<2.9,>=2.5 in c:\users\heman\appdata\roaming\python\python37\site-packages (from requests<3.0.0,>=2.20.0->azure-iot-device) (2.8)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in c:\users\heman\appdata\roaming\python\python37\site-packages (from requests<3.0.0,>=2.20.0->azure-iot-device) (3.0.4)
PS C:\data\code\youtube\iothub\python-send-message> python --version
Python 3.7.1
PS C:\data\code\youtube\iothub\python-send-message> pip --version
pip 20.2.1 from c:\users\heman\appdata\local\programs\python\python37-32\lib\site-packages\pip (python 3.7)
PS C:\data\code\youtube\iothub\python-send-message>
我看到几个线程讨论相同的问题,但不确定解决方案是什么。
任何指针,如何在 Windows 机器上解决这个问题?
解决方案
你可以试试pip3吗?
pip3 install azure-iot-device
推荐阅读
- perl - 如何在不干扰格式的情况下对数字进行排序
- python - 使用二进制信息有效地保存 4D 数组
- reactjs - 如何在 Next.js 中执行客户端数据获取
- mysql - Mysql INNER JOIN 在 LEFT OUTER JOIN 之后
- android - 在 Flutter 和 iOS 中使用可变主机进行深度链接
- sql - 如何将此使用连接语句的查询转换为使用子查询的查询?
- java - 在 Spring Boot 中检索 bean?
- python - 为什么 1//0.01 == 99 在 Python 中?
- c# - Azure DevOps Api 错误:RuleValidationException:字段“状态”包含不在支持值列表中的值“活动”C#
- python - jupyter notebooks 加载 nbextensions 的问题