簡體   English   中英

虛擬環境下安裝fastapi出錯

[英]Error in installing fastapi in virtual environment

嘗試安裝 fastapi:

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

收到以下錯誤:

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. 

嘗試使用這個:

pip install fastapi

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM