raspberrypi ImportError: No module named servicebus
raspberrypi ImportError: No module named servicebus
我在 运行 python Azure ServiceBus 脚本时收到此错误。
是文件位置不对,还是我导入不正确?
pi@raspberrypi:~/letsroll $ python mrrobot.py
Traceback (most recent call last):
File "mrrobot.py", line 6, in <module>
from azure.servicebus import ServiceBusService
ImportError: No module named servicebus
Azure SDK 路径: pi@raspberrypi:~/azure-sdk-for-python $
Python 脚本路径:
pi@raspberrypi:~/letsroll $ ls
mrrobot.py
mrrobot.py
import RPi.GPIO as GPIO #For Controlling the Pins
import threading #To Run On Thread
import sys
import select
from azure.servicebus import ServiceBusService
import os
# Make sure you set the following:
AZURE_SERVICEBUS_NAMESPACE='mrrobot' #Your NameSpace Should Go Here
# Note: this user should have manage rights
AZURE_SERVICEBUS_SHARED_KEY_NAME='RootManageSharedAccessKey'
AZURE_SERVICEBUS_ACCESS_KEY_VALUE='MpcCdemokey'
GPIO_BCM_PIN = 17 #Pin your LED is connected to
您的 Python 解释器没有找到包。可能有以下几个原因:
- 您没有正确安装 SDK(文件丢失)。您可以直接使用 pip,"git clone" 来自 repo,或者 copy/pasting 来自 PyPI 的 "azure-servicebus" zip 并解压。由于您没有共享
pi@raspberrypi:~/azure-sdk-for-python
文件夹的内容,因此我无法判断。如果您手动安装代码,请不要忘记依赖项。
- 您的包路径没有明确定义。同样,可以通过定义 PYTHONPATH or changing your sys.path
等多种方式进行修复
我在 运行 python Azure ServiceBus 脚本时收到此错误。
是文件位置不对,还是我导入不正确?
pi@raspberrypi:~/letsroll $ python mrrobot.py
Traceback (most recent call last):
File "mrrobot.py", line 6, in <module>
from azure.servicebus import ServiceBusService
ImportError: No module named servicebus
Azure SDK 路径: pi@raspberrypi:~/azure-sdk-for-python $
Python 脚本路径:
pi@raspberrypi:~/letsroll $ ls
mrrobot.py
mrrobot.py
import RPi.GPIO as GPIO #For Controlling the Pins
import threading #To Run On Thread
import sys
import select
from azure.servicebus import ServiceBusService
import os
# Make sure you set the following:
AZURE_SERVICEBUS_NAMESPACE='mrrobot' #Your NameSpace Should Go Here
# Note: this user should have manage rights
AZURE_SERVICEBUS_SHARED_KEY_NAME='RootManageSharedAccessKey'
AZURE_SERVICEBUS_ACCESS_KEY_VALUE='MpcCdemokey'
GPIO_BCM_PIN = 17 #Pin your LED is connected to
您的 Python 解释器没有找到包。可能有以下几个原因:
- 您没有正确安装 SDK(文件丢失)。您可以直接使用 pip,"git clone" 来自 repo,或者 copy/pasting 来自 PyPI 的 "azure-servicebus" zip 并解压。由于您没有共享
pi@raspberrypi:~/azure-sdk-for-python
文件夹的内容,因此我无法判断。如果您手动安装代码,请不要忘记依赖项。 - 您的包路径没有明确定义。同样,可以通过定义 PYTHONPATH or changing your sys.path 等多种方式进行修复