简体   繁体   English

ModuleNotFoundError:使用 pyfcm 时没有名为“requests.adapters”的模块

[英]ModuleNotFoundError: No module named 'requests.adapters' when using pyfcm

I'm trying to use pyfcm library in my django project, by adding it to requiements.txt but I noticed that it is getting an error that mainly comes because of trying to import from requests library.. here is the error:我试图在我的 django 项目中使用pyfcm库,方法是将它添加到requiements.txt ,但我注意到它出现错误,这主要是因为尝试从requests库导入。这是错误:

rolla_django       |     from pyfcm import FCMNotification
rolla_django       |   File "/usr/local/lib/python3.10/dist-packages/pyfcm/__init__.py", line 14, in <module>
rolla_django       |     from .fcm import FCMNotification
rolla_django       |   File "/usr/local/lib/python3.10/dist-packages/pyfcm/fcm.py", line 1, in <module>
rolla_django       |     from .baseapi import BaseAPI
rolla_django       |   File "/usr/local/lib/python3.10/dist-packages/pyfcm/baseapi.py", line 6, in <module>
rolla_django       |     from requests.adapters import HTTPAdapter
rolla_django       | ModuleNotFoundError: No module named 'requests.adapters'

and here is my requirements.txt这是我的requirements.txt

Django~=4.1.1
djangorestframework~=3.13.1
django-extensions
pymysql~=1.0.2
requests
tzdata
psycopg2-binary
django-crontab
pyfcm 

You can try these things你可以试试这些东西

  1. Update pyfcm to the latest version (1.5.4)更新pyfcm到最新版本(1.5.4)
  2. Update requests to the latest version (2.28.1)更新请求到最新版本(2.28.1)

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM