我正在尝试连接 firebase 身份验证。我安装了所需的模块,但上述错误我无法解决。
我试图为 gcloud 创建一个 hooks 目录,但仍然没有解决问题。
import pyrebase
config = {
"apiKey": "AIzaSyA13_Zm0WCy4Rg1gPVZ12kPM4p5ei6b40A",
"authDomain": "timbercal-ecrew1.firebaseapp.com",
"databaseURL": "https://timbercal-ecrew1.firebaseio.com",
"storageBucket": "timbercal-ecrew1.appspot.com"
}
firebase = pyrebase.initialize_app(config)
print("Hi Sam")
这是我得到的错误:
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "C:\Program Files\JetBrains\PyCharm 2019.1.1\helpers\pydev\_pydev_bundle\pydev_umd.py", line 197, in runfile
pydev_imports.execfile(filename, global_vars, local_vars) # execute the script
File "C:\Program Files\JetBrains\PyCharm 2019.1.1\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "C:/Users/samas/PycharmProjects/Testind2/FirebaseAuth.py", line 1, in <module>
import pyrebase
File "C:\Program Files\JetBrains\PyCharm 2019.1.1\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "C:\Users\samas\AppData\Local\Programs\Python\Python37-32\lib\pyrebase\__init__.py", line 1, in <module>
from .pyrebase import initialize_app
File "C:\Program Files\JetBrains\PyCharm 2019.1.1\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "C:\Users\samas\AppData\Local\Programs\Python\Python37-32\lib\pyrebase\pyrebase.py", line 18, in <module>
from gcloud import storage
File "C:\Program Files\JetBrains\PyCharm 2019.1.1\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "C:\Users\samas\AppData\Local\Programs\Python\Python37-32\lib\gcloud\__init__.py", line 19, in <module>
__version__ = get_distribution('gcloud').version
File "C:\Users\samas\AppData\Local\Programs\Python\Python37-32\lib\pkg_resources\__init__.py", line 481, in get_distribution
dist = get_provider(dist)
File "C:\Users\samas\AppData\Local\Programs\Python\Python37-32\lib\pkg_resources\__init__.py", line 357, in get_provider
return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
File "C:\Users\samas\AppData\Local\Programs\Python\Python37-32\lib\pkg_resources\__init__.py", line 900, in require
needed = self.resolve(parse_requirements(requirements))
File "C:\Users\samas\AppData\Local\Programs\Python\Python37-32\lib\pkg_resources\__init__.py", line 786, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'gcloud' distribution was not found and is required by the application