【fastapi】AttributeError: ‘FastAPI‘ object has no attribute ‘_debug‘

又是一个美好而又期待的周末即将到来,再记录下方才遇到的问题:

AttributeError: ‘FastAPI’ object has no attribute ‘_debug’

不扯犊子了,直接摆出来解决方案:
版本冲突导致

fastapi==0.89.1
pip install starlette==0.22.0

切换成这个版本后就成功了;

错误的一些版本查询日志:

wsw@wsw88:/home$ pip list | grep fastap
fastapi            0.92.0
WARNING: The repository located at pypi.douban.com is not a trusted or secure host and is being ignored. If this repository is available ce this warning and allow it anyway with '--trusted-host pypi.douban.com'.
wsw@wsw88:/home$ pip list | grep starlette
starlette          0.25.0
WARNING: The repository located at pypi.douban.com is not a trusted or secure host and is being ignored. If this repository is available via HTTPS we recommend you use HTTPS instead, otherwise you may silence this warning and allow it anyway with '--trusted-host pypi.douban.com'.
wsw@wsw88:/home$ pip install starlette==0.22.0
Looking in indexes: http://pypi.douban.com/simple
Collecting starlette==0.22.0
  Downloading http://pypi.doubanio.com/packages/1d/4e/30eda84159d5b3ad7fe663c40c49b16dd17436abe838f10a56c34bee44e8/starlette-0.22.0-py3-none-any.whl (64 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 64.3/64.3 kB 2.6 MB/s eta 0:00:00
Requirement already satisfied: typing-extensions>=3.10.0 in ./wsw/lib/python3.8/site-packages (from starlette==0.22.0) (4.5.0)
Requirement already satisfied: anyio<5,>=3.4.0 in ./wsw/lib/python3.8/site-packages (from starlette==0.22.0) (3.6.2)
Requirement already satisfied: idna>=2.8 in ./wsw/lib/python3.8/site-packages (from anyio<5,>=3.4.0->starlette==0.22.0) (3.4)
Requirement already satisfied: sniffio>=1.1 in ./wsw/lib/python3.8/site-packages (from anyio<5,>=3.4.0->starlette==0.22.0) (1.3.0)
Installing collected packages: starlette
  Attempting uninstall: starlette
    Found existing installation: starlette 0.25.0
    Uninstalling starlette-0.25.0:
      Successfully uninstalled starlette-0.25.0
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
fastapi 0.92.0 requires starlette<0.26.0,>=0.25.0, but you have starlette 0.22.0 which is incompatible.
Successfully installed starlette-0.22.0
wsw@wsw88:/home$ pip install fastapi==0.89.1
Looking in indexes: http://pypi.douban.com/simple
Collecting fastapi==0.89.1
  Downloading http://pypi.doubanio.com/packages/8f/89/adf4525d1870021b65ec562e83e9f46d96494ad95f238d0264ef1ab6b604/fastapi-0.89.1-py3-none-any.whl (55 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 55.8/55.8 kB 3.3 MB/s eta 0:00:00
Requirement already satisfied: pydantic!=1.7,!=1.7.1,!=1.7.2,!=1.7.3,!=1.8,!=1.8.1,<2.0.0,>=1.6.2 in ./wsw/lib/python3.8/site-packages (from fastapi==0.89.1) (1.10.5)
Requirement already satisfied: starlette==0.22.0 in ./wsw/lib/python3.8/site-packages (from fastapi==0.89.1) (0.22.0)
Requirement already satisfied: typing-extensions>=3.10.0 in ./wsw/lib/python3.8/site-packages (from starlette==0.22.0->fastapi==0.89.1) (4.5.0)
Requirement already satisfied: anyio<5,>=3.4.0 in ./wsw/lib/python3.8/site-packages (from starlette==0.22.0->fastapi==0.89.1) (3.6.2)
Requirement already satisfied: sniffio>=1.1 in ./wsw/lib/python3.8/site-packages (from anyio<5,>=3.4.0->starlette==0.22.0->fastapi==0.89.1) (1.3.0)
Requirement already satisfied: idna>=2.8 in ./wsw/lib/python3.8/site-packages (from anyio<5,>=3.4.0->starlette==0.22.0->fastapi==0.89.1) (3.4)
Installing collected packages: fastapi
  Attempting uninstall: fastapi
    Found existing installation: fastapi 0.92.0
    Uninstalling fastapi-0.92.0:
      Successfully uninstalled fastapi-0.92.0
Successfully installed fastapi-0.89.1
wsw@wsw88:/home$ pip install starlette==0.22.0
Looking in indexes: http://pypi.douban.com/simple
Requirement already satisfied: starlette==0.22.0 in ./wsw/lib/python3.8/site-packages (0.22.0)
Requirement already satisfied: typing-extensions>=3.10.0 in ./wsw/lib/python3.8/site-packages (from starlette==0.22.0) (4.5.0)
Requirement already satisfied: anyio<5,>=3.4.0 in ./wsw/lib/python3.8/site-packages (from starlette==0.22.0) (3.6.2)
Requirement already satisfied: sniffio>=1.1 in ./wsw/lib/python3.8/site-packages (from anyio<5,>=3.4.0->starlette==0.22.0) (1.3.0)
Requirement already satisfied: idna>=2.8 in ./wsw/lib/python3.8/site-packages (from anyio<5,>=3.4.0->starlette==0.22.0) (3.4)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

魔都吴所谓

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值