ImportError:无法从“fastapi\u缓存”导入名称“FastAPICache”

2024-06-17 13:25:33 发布

您现在位置:Python中文网/ 问答频道 /正文

我在尝试从docker映像运行API时遇到以下问题。在本地运行它没有问题

这是我的requirements.txt

fastapi==0.63.0
fastapi-cache==0.1.0

完整错误消息:

from api.routers import sa_ranking, sa_person_ranking
  File "./api/routers/sa_ranking.py", line 9, in <module>
    from fastapi_cache import FastAPICache
ImportError: cannot import name 'FastAPICache' from 'fastapi_cache' (/usr/local/lib/python3.8/site-packages/fastapi_cache/__init__.py)

请帮忙。多谢各位


Tags: dockerfrompyimporttxtapicache错误