ModuleNotFoundError: No module named 'pyasn1'

ModuleNotFoundError: No module named 'pyasn1'

File "D:\Documents\my_project\firebase_login.py", line 1, in <module>
     from pyrebase import pyrebase
   File "D:\Documents\Python_projects\Test_kivy\venv\lib\site-packages\pyrebase\__init__.py", line 1, in <module>
     from .pyrebase import initialize_app
   File "D:\Documents\Python_projects\Test_kivy\venv\lib\site-packages\pyrebase\pyrebase.py", line 17, in <module>
     from oauth2client.service_account import ServiceAccountCredentials
   File "D:\Documents\Python_projects\Test_kivy\venv\lib\site-packages\oauth2client\service_account.py", line 26, in <module>
     from oauth2client import crypt
   File "D:\Documents\Python_projects\Test_kivy\venv\lib\site-packages\oauth2client\crypt.py", line 23, in <module>
     from oauth2client import _pure_python_crypt
   File "D:\Documents\Python_projects\Test_kivy\venv\lib\site-packages\oauth2client\_pure_python_crypt.py", line 22, in <module>
     from pyasn1.codec.der import decoder
 ModuleNotFoundError: No module named 'pyasn1'

Process finished with exit code 1

我的代码昨天运行得非常好,今天我无法启动它,因为 pyrebase 崩溃了。 我有一个来自 PyCharm 项目的错误。

Pyrebase4:v4.5.0 https://github.com/nhorvath/Pyrebase4

我遇到了同样的问题,我解决了更新 pip。 我还在 github.

上发现了类似的 import issue 打开

python -m ensurepip

python get-pip.py

pip install awscli --ignore-installed six

ModuleNotFoundError: 没有名为 'pyasn1_modules'

的模块

pip install pyasn1_modules

ModuleNotFoundError: 没有名为 'google.protobuf'

的模块

pip install protobuf