[英]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:以下是为我解决问题的方法:
First run the command python3 -m pip show python-firebase
.首先运行命令
python3 -m pip show python-firebase
。
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
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_pool
到from .nasync import process_pool
您也可以在重复这个firebase.py
文件。
Hope this helps :)希望这可以帮助 :)
这仍然不起作用是否有一个干净的python-firebase版本我们可以安装它与python3.8一起使用
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.