python - 在 Python 中调用 Pyrebase 时出现未知语法错误

标签 python firebase pyrebase

我不知道如何总结或格式化问题,我提供了错误


Traceback (most recent call last): File "push.py", line 1, in from pyrebase import pyrebase File "C:\Users\USERNAME\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pyrebase__init__.py", line 1, in from .pyrebase import initialize_app File "C:\Users\USERNAME\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pyrebase\pyrebase.py", line 17, in from oauth2client.service_account import ServiceAccountCredentials File "C:\Users\USERNAME\AppData\Local\Programs\Python\Python37-32\lib\site-packages\oauth2client\service_account.py", line 25, in from oauth2client import client File "C:\Users\USERNAME\AppData\Local\Programs\Python\Python37-32\lib\site-packages\oauth2client\client.py", line 45, in from oauth2client import crypt File "C:\Users\USERNAME\AppData\Local\Programs\Python\Python37-32\lib\site-packages\oauth2client\crypt.py", line 55, in from oauth2client import _pycrypto_crypt File "C:\Users\USERNAME\AppData\Local\Programs\Python\Python37-32\lib\site-packages\oauth2client_pycrypto_crypt.py", line 17, in from Crypto.PublicKey import RSA File "C:\Users\USERNAME\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pycrypto-2.6.1-py3.7-win32.egg\Crypto\PublicKey\RSA.py", line 75, in from Crypto.Util.number import getRandomRange, bytes_to_long, long_to_bytes File "C:\Users\USERNAME\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pycrypto-2.6.1-py3.7-win32.egg\Crypto\Util\number.py", line 139 value = 2L ** (N-1) # Ensure high bit is set ^ SyntaxError: invalid syntax


我在安装 Pyrebase 时出错,所以我目前使用的是 Pyrebase4 我还尝试安装 PyCryptoDome,然后在配置后手动安装 Pyrebase 以避免版本控制错误 这是我的代码:

import pyrebase

config={keys and all go here}

firebase=pyrebase.initialize_app(config)
db=firebase.database()

db.child("names").push({"name":"Abhinav"})

期望将数据推送到Firebase

最佳答案

如果你已经安装了 pyrebase (v3) 并且不能正常工作就这样做

pip3 install pyrebase4

关于python - 在 Python 中调用 Pyrebase 时出现未知语法错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57333606/

相关文章:

python - 如何使用 Scapy 在 DHCP header 中添加参数请求列表?

c++ - 在Python中解析.c/.cpp/.py源文件以获取包含的函数列表

java - 如何在 Android 上将 Observable 模式与 Firebase 结合使用

java - 如何从 Firebase 存储获取 URL getDownloadURL

android - firestore 内部断言失败

python-3.x - 在 Windows Python 3.7 上安装 pyrebase 失败

python - 保存多个对象直接从内存压缩

python - 为什么将 DatetimeIndex 转换为 np.array 时格式会发生变化?

python - 如何从 Firebase 实时数据库获取最新记录