【问题标题】:FastAPI "ERROR: Failed building wheel for python-multipart" in basic "hello world" tutorial基本“hello world”教程中的 FastAPI“错误:python-multipart 构建轮失败”
【发布时间】:2022-07-14 02:08:17
【问题描述】:

我关注FastAPI "hello world" tutorial。作为第 1 步,我需要运行(我在 venv 中使用 python 3.8):

pip install "fastapi[all]"

但我明白了:

Building wheels for collected packages: python-multipart
  Building wheel for python-multipart (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: venv/my_venv/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-u0lo92at/python-multipart/setup.py'"'"'; __file__='"'"'/tmp/pip-install-u0lo92at/python-multipart/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-f5_nolf4
       cwd: /tmp/pip-install-u0lo92at/python-multipart/
  Complete output (6 lines):
  usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
     or: setup.py --help [cmd1 cmd2 ...]
     or: setup.py --help-commands
     or: setup.py cmd --help
  
  error: invalid command 'bdist_wheel'
  ----------------------------------------
  ERROR: Failed building wheel for python-multipart
  Running setup.py clean for python-multipart
Failed to build python-multipart

当我转到第 2 步时,它说:

$ uvicorn main:app --reload

Command 'uvicorn' not found, but can be installed with:

sudo apt install uvicorn

虽然说uvicorn一开始是用命令安装的:

【问题讨论】:

    标签: python python-3.x fastapi


    【解决方案1】:

    只需重新安装即可。

    pip install "fastapi[all]"
    

    之后就可以运行了

    uvicorn main:app --reload
    

    无需进一步安装。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-03-12
      • 2012-02-02
      • 1970-01-01
      • 2016-11-27
      • 1970-01-01
      • 2023-03-03
      • 2023-03-30
      相关资源
      最近更新 更多