Google App 引擎 Firebase 导入错误
Google App engine Firebase import error
我正在做一个项目,我想在 webapp2 中使用 firebase python。我在项目的根目录中创建了 lib 文件夹以使用第三方库。然后我导入了 firebase admin,它在导入时出现以下错误。请帮助我哪里做错了,谢谢
进口:
import firebase_admin
import google.auth.transport.requests
import google.oauth2.id_token
from firebase_admin import auth
from firebase_admin import credentials
日志:
Traceback (most recent call last):
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\runtime\wsgi.py", line 240, in Handle
handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\runtime\wsgi.py", line 299, in _LoadHandler
handler, path, err = LoadObject(self._handler)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\runtime\wsgi.py", line 85, in LoadObject
obj = __import__(path[0])
File "D:\Work\Bolt Reactor\Final Website Production\kompassera\Routes.py", line 5, in <module>
from controllers import Home, Signup, Login, Profile, Listing, Classroom, Search, Enrollment, Firebase
File "D:\Work\Bolt Reactor\Final Website Production\kompassera\controllers\Signup.py", line 5, in <module>
import firebase_admin
File "D:\Work\Bolt Reactor\Final Website Production\kompassera\lib\firebase_admin\__init__.py", line 22, in <module>
from firebase_admin import credentials
File "D:\Work\Bolt Reactor\Final Website Production\kompassera\lib\firebase_admin\credentials.py", line 20, in <module>
import google.auth
ImportError: No module named auth
说明
import google.auth.transport.requests
以上行将在每台机器上的 pythons 默认目录中查找 Google 包,此行为可能会有所不同,具体取决于我要查找已安装包的位置。
解决方法:
在项目的根目录下创建一个 lib 目录,并将 google 包放在这个 lib 目录中,然后在这个 lib 文件夹中添加 ____inti____.py 并像这样修改你的导入
import lib.firebase_admin
import lib.google.auth.transport.requests
import lib.google.oauth2.id_token
from lib.firebase_admin import auth
from lib.firebase_admin import credentials
我正在做一个项目,我想在 webapp2 中使用 firebase python。我在项目的根目录中创建了 lib 文件夹以使用第三方库。然后我导入了 firebase admin,它在导入时出现以下错误。请帮助我哪里做错了,谢谢
进口:
import firebase_admin
import google.auth.transport.requests
import google.oauth2.id_token
from firebase_admin import auth
from firebase_admin import credentials
日志:
Traceback (most recent call last):
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\runtime\wsgi.py", line 240, in Handle
handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\runtime\wsgi.py", line 299, in _LoadHandler
handler, path, err = LoadObject(self._handler)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\runtime\wsgi.py", line 85, in LoadObject
obj = __import__(path[0])
File "D:\Work\Bolt Reactor\Final Website Production\kompassera\Routes.py", line 5, in <module>
from controllers import Home, Signup, Login, Profile, Listing, Classroom, Search, Enrollment, Firebase
File "D:\Work\Bolt Reactor\Final Website Production\kompassera\controllers\Signup.py", line 5, in <module>
import firebase_admin
File "D:\Work\Bolt Reactor\Final Website Production\kompassera\lib\firebase_admin\__init__.py", line 22, in <module>
from firebase_admin import credentials
File "D:\Work\Bolt Reactor\Final Website Production\kompassera\lib\firebase_admin\credentials.py", line 20, in <module>
import google.auth
ImportError: No module named auth
说明
import google.auth.transport.requests
以上行将在每台机器上的 pythons 默认目录中查找 Google 包,此行为可能会有所不同,具体取决于我要查找已安装包的位置。
解决方法: 在项目的根目录下创建一个 lib 目录,并将 google 包放在这个 lib 目录中,然后在这个 lib 文件夹中添加 ____inti____.py 并像这样修改你的导入
import lib.firebase_admin
import lib.google.auth.transport.requests
import lib.google.oauth2.id_token
from lib.firebase_admin import auth
from lib.firebase_admin import credentials