ModuleNotFoundError:RaspberryPi中没有名为“ firebase”的模块

时间:2019-07-16 08:34:16

标签: python module find

我正在执行这个项目,该项目使用RaspberryPi发送遥控车的指令。我在Raspberry pi中编写了一个简单的python代码,如下所示。但是我在将数据插入Firebase时遇到问题。但是,出现以下错误“模块未找到firebase”。请帮助我解决我面临的这个问题。

RaspberryPi中的

// python_code

import RPi.GPIO  as gpio
from firebase import firebase
import time

firebase= firebase.FirebaseApplication('https://console.firebase.google.com/project/lambo-c1a69/database/lambo-c1a69/data/',None)
def init():
    gpio.setmode(gpio.BCM)
    gpio.setup(17, gpio.OUT)
    gpio.setup(22, gpio.OUT)
    gpio.setup(23, gpio.OUT)
    gpio.setup(24, gpio.OUT)

def forward(tf):
    init()
    gpio.output(17, True)
    gpio.output(22, False)
    gpio.output(23, True)
    gpio.output(24, False)
    time.sleep(tf)
    gpio.cleanup()
def reverse(tf):
    init()
    gpio.output(17, False)
    gpio.output(22, True)
    gpio.output(23, False)
    gpio.output(24, True)
    time.sleep(tf)
    gpio.cleanup()
def left(tf):
    init()
    gpio.output(17, False)
    gpio.output(22, False)
    gpio.output(23, True)
    gpio.output(24, False)
    time.sleep(tf)
    gpio.cleanup()    

while True:
    userInput = input("enter the car direction : ")
    if userInput == "forward":
       print("forward")
       result=firebase.post('/',{'forward'})
       forward(4)
    elif userInput == "backward":
       print("reverse")
       reverse(2)
    elif userInput == "left":
       print("left")

0 个答案:

没有答案