简体   繁体   English

无法使用 python 3.72 连接 firebase

[英]unable to connect firebase using python 3.72

if anyone knows how to python 3.7 version connect with firebase. I 'm using the following code,如果有人知道如何将 python 3.7 版本与 firebase 连接。我正在使用以下代码,

from firebase import firebase
firebase = firebase.FirebaseApplication('https://your_storage.firebaseio.com', None)
result = firebase.get('/users', None)
print (result)

it gave the following error ImportError: cannot import name 'firebase' from 'firebase'它给出了以下错误 ImportError: cannot import name 'firebase' from 'firebase'

I tried this and I too got an error while importing.我试过这个,我在导入时也遇到了错误。 From what I gather, python-firebase hasn't been updated to be fully compatible with python 3.7 or perhaps this is a rare issue.据我所知,python-firebase 尚未更新为与 python 3.7 完全兼容,或者这可能是一个罕见的问题。

What I found was that the firebase module actually had an error as it used python's protected keyword async as a filename.我发现 firebase 模块实际上有一个错误,因为它使用 python 的 protected 关键字async作为文件名。

Here's what fixed the issue for me:以下是为我解决问题的方法:

  1. First run the command python3 -m pip show python-firebase .首先运行命令python3 -m pip show python-firebase

  2. From there you should see a path to the pip folder.从那里您应该看到 pip 文件夹的路径。 This could look like Location: /usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages这可能看起来像Location: /usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages

  3. Navigate to that folder and find your "firebase" folder.导航到该文件夹​​并找到您的“firebase”文件夹。 Once in the folder, rename the async.py file to something else, I renamed it to nasync.py .进入文件夹后,将async.py文件重命名为其他名称,我将其重命名为nasync.py Next you should open the __init__.py file and change the import declaration from from .async import process_pool to from .nasync import process_pool You also have to repeat this in the firebase.py file.接下来,你应该打开__init__.py文件,更改从进口报关from .async import process_poolfrom .nasync import process_pool您也可以在重复这个firebase.py文件。

Hope this helps :)希望这可以帮助 :)

这仍然不起作用是否有一个干净的python-firebase版本我们可以安装它与python3.8一起使用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法使用 exec 连接到 firebase 仿真器套件 - Unable to connect to firebase emulator suite with exec 无法在Flutter项目的Android模拟器中连接Firebase - Unable to connect Firebase in Android Emulator for Flutter Project 无法将 Google firebase 与 MIT App Inventor 连接 - Unable to connect Google firebase with MIT App Inventor 如何连接 Firebase Auth 模拟器和 Python - How to Connect Firebase Auth Emulator With Python 如何使用typescript连接Swift中的Firebase模拟器? - How to connect Firebase emulator in Swift by using typescript? 无法连接本地 Firebase 模拟器套件托管与 Firestore(Web 版本 9) - Unable to connect local Firebase emulator suite Hosting with Firestore (Web version 9) 无法使用数据块连接从 Windows 连接到数据块集群 - Unable to connect to databricks cluster from Windows using databricks-connect 无法连接到 AWS ElastiCache 表单 python 客户端 - Unable to connect to AWS ElastiCache form python client 使用 python 从 firebase 注销 - signout from firebase using python 如何使用 Python 验证到 Firebase? - How to authenticate to Firebase using Python?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM