ModulenotFoundError:没有名为“ Azure”的模块

我正在尝试在Windows开发计算机上运行 this 示例代码。我尝试运行 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:datacodeyoutubeiothubpython-send-message> py --version
    Python 3.8.5

    PS C:datacodeyoutubeiothubpython-send-message>pip install azure-iot-device
    Requirement already satisfied: azure-iot-device in c:usershemanappdatalocalprogramspythonpython37-32libsite-packages (2.1.4)
    Requirement already satisfied: PySocks in c:usershemanappdatalocalprogramspythonpython37-32libsite-packages (from azure-iot-device) (1.7.1)
    Requirement already satisfied: six<2.0.0,>=1.12.0 in c:usershemanappdatalocalprogramspythonpython37-32libsite-packages (from azure-iot-device) (1.15.0)
    Requirement already satisfied: paho-mqtt<2.0.0,>=1.4.0 in c:usershemanappdatalocalprogramspythonpython37-32libsite-packages (from azure-iot-device) (1.5.0)
    Requirement already satisfied: requests-unixsocket<1.0.0,>=0.1.5 in c:usershemanappdatalocalprogramspythonpython37-32libsite-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:usershemanappdataroamingpythonpython37site-packages (from azure-iot-device) (1.24.2)
    Requirement already satisfied: requests<3.0.0,>=2.20.0 in c:usershemanappdataroamingpythonpython37site-packages (from azure-iot-device) (2.21.0)
    Requirement already satisfied: janus==0.4.0; python_version >= "3.5" in c:usershemanappdatalocalprogramspythonpython37-32libsite-packages (from azure-iot-device) (0.4.0)
    Requirement already satisfied: certifi>=2017.4.17 in c:usershemanappdataroamingpythonpython37site-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:usershemanappdataroamingpythonpython37site-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:usershemanappdataroamingpythonpython37site-packages (from requests<3.0.0,>=2.20.0->azure-iot-device) (3.0.4)

PS C:datacodeyoutubeiothubpython-send-message> python --version
Python 3.7.1
PS C:datacodeyoutubeiothubpython-send-message> pip --version
pip 20.2.1 from c:usershemanappdatalocalprogramspythonpython37-32libsite-packagespip (python 3.7)
PS C:datacodeyoutubeiothubpython-send-message>

我看到 couple of 线程讨论相同的问题,但不确定该分辨率是什么。

有任何指示,如何在Windows机器上解决此问题?

stack overflow ModuleNotFoundError: No module named 'azure'
原文答案