简体   繁体   中英

Google Compute Engine firebase is not a module

trying to use the VM as a server to host some python code but it has a problem with the files import of 'firebase'

Output: ImportError: No module named firebase

Has anyone had this or anything like this before?

The file which I'm trying run the app from is (serveme.py):

    from flask import Flask, request, render_template
from firebase import firebase
import json
import requests
import os.path

firebase = firebase.FirebaseApplication('https://***********.firebaseio.com/')

app = Flask(__name__)




@app.route('/')
def index():
   return 'Method was %s' % request.method

@app.route('/firetest', methods=['GET', 'POST'])

etc etc. It has a problem with the import at line 2.

I am using gunicorn to do

gunicorn -w 2 -b :5000 serveme:app

You have to run

sudo easy_install pip

then you're able to do

sudo pip install requests
sudo pip install python-firebase

Python was already installed, apparently you have to install pip again, brew doesn't like multiple downloads of the same package. So use the easy install for just pip.

Hope this helps someone else if they ever come across this.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM