简体   繁体   English

虚拟环境下安装fastapi出错

[英]Error in installing fastapi in virtual environment

Trying to install fastapi:尝试安装 fastapi:

(venv) D:\api>pip install fastapi[all]

Getting the following error:收到以下错误:

ERROR: Command errored out with exit status 1:
     command: 'D:\api\venv\Scripts\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\LENOVO\\AppData\\Local\\Temp\\pip-install-od3lrye2\\httptools_c5b546c7a9f54ea0831a3639b44e79da\\setup.py'"'"'; __file__='"'"'C:\\Users\\LENOVO\\AppData\\Local\\Temp\\pip-install-od3lrye2\\httptools_c5b546c7a9f54ea0831a3639b44e79da\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\LENOVO\AppData\Local\Temp\pip-record-x1m88nnc\install-record.txt' --single-version-externally-managed --compile --install-headers 'D:\api\venv\include\site\python3.10\httptools'
         cwd: C:\Users\LENOVO\AppData\Local\Temp\pip-install-od3lrye2\httptools_c5b546c7a9f54ea0831a3639b44e79da\
    Complete output (25 lines):
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.10
    creating build\lib.win-amd64-3.10\httptools
    copying httptools\_version.py -> build\lib.win-amd64-3.10\httptools
    copying httptools\__init__.py -> build\lib.win-amd64-3.10\httptools
    creating build\lib.win-amd64-3.10\httptools\parser
    copying httptools\parser\errors.py -> build\lib.win-amd64-3.10\httptools\parser
    copying httptools\parser\__init__.py -> build\lib.win-amd64-3.10\httptools\parser
    running egg_info
    writing httptools.egg-info\PKG-INFO
    writing dependency_links to httptools.egg-info\dependency_links.txt
    writing requirements to httptools.egg-info\requires.txt
    writing top-level names to httptools.egg-info\top_level.txt
    reading manifest file 'httptools.egg-info\SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    adding license file 'LICENSE'
    writing manifest file 'httptools.egg-info\SOURCES.txt'
    copying httptools\parser\parser.c -> build\lib.win-amd64-3.10\httptools\parser
    copying httptools\parser\url_parser.c -> build\lib.win-amd64-3.10\httptools\parser
    running build_ext
    building 'httptools.parser.parser' extension
    error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'D:\api\venv\Scripts\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\LENOVO\\AppData\\Local\\Temp\\pip-install-od3lrye2\\httptools_c5b546c7a9f54ea0831a3639b44e79da\\setup.py'"'"'; __file__='"'"'C:\\Users\\LENOVO\\AppData\\Local\\Temp\\pip-install-od3lrye2\\httptools_c5b546c7a9f54ea0831a3639b44e79da\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\LENOVO\AppData\Local\Temp\pip-record-x1m88nnc\install-record.txt' --single-version-externally-managed --compile --install-headers 'D:\api\venv\include\site\python3.10\httptools' Check the logs for full command output. 

try use this:尝试使用这个:

pip install fastapi

https://pypi.org/project/fastapi/ https://pypi.org/project/fastapi/

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

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