我无法将 fastapi 安装到 VSC
Posted
技术标签:
【中文标题】我无法将 fastapi 安装到 VSC【英文标题】:I can't install fastapi to VSC 【发布时间】:2022-01-19 14:03:46 【问题描述】:当我尝试安装 FAST API 工具时,写:
(venv) C:\Users\bahadir.yalin\Desktop\Kişisel Dökümanlar\PythonWorks\fastapi>pip install fastapi[all]
terminal throws me exception error (by the way i upgraded pip to latest version), which is:
ERROR: Exception:
Traceback (most recent call last):
File "C:\Users\bahadir.yalin\Desktop\Kişisel Dökümanlar\PythonWorks\fastapi\venv\lib\site-packages\pip\_internal\cli\base_command.py", line 164, in exc_logging_wrapper
status = run_func(*args)
File "C:\Users\bahadir.yalin\Desktop\Kişisel Dökümanlar\PythonWorks\fastapi\venv\lib\site-packages\pip\_internal\cli\req_command.py", line 205, in wrapper
return func(self, options, args)
File "C:\Users\bahadir.yalin\Desktop\Kişisel Dökümanlar\PythonWorks\fastapi\venv\lib\site-packages\pip\_internal\commands\install.py", line 338, in run
requirement_set = resolver.resolve(
File "C:\Users\bahadir.yalin\Desktop\Kişisel Dökümanlar\PythonWorks\fastapi\venv\lib\site-packages\pip\_internal\resolution\resolvelib\resolver.py", line 92, in resolve
result = self._result = resolver.resolve(
File "C:\Users\bahadir.yalin\Desktop\Kişisel Dökümanlar\PythonWorks\fastapi\venv\lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 482, in resolve
state = resolution.resolve(requirements, max_rounds=max_rounds)
File "C:\Users\bahadir.yalin\Desktop\Kişisel Dökümanlar\PythonWorks\fastapi\venv\lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 374, in resolve
failure_causes = self._attempt_to_pin_criterion(name)
File "C:\Users\bahadir.yalin\Desktop\Kişisel Dökümanlar\PythonWorks\fastapi\venv\lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 214, in _attempt_to_pin_criterion
criteria = self._get_updated_criteria(candidate)
File "C:\Users\bahadir.yalin\Desktop\Kişisel Dökümanlar\PythonWorks\fastapi\venv\lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 205, in _get_updated_criteria
self._add_to_criteria(criteria, requirement, parent=candidate)
File "C:\Users\bahadir.yalin\Desktop\Kişisel Dökümanlar\PythonWorks\fastapi\venv\lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 173, in _add_to_criteria
if not criterion.candidates:
File "C:\Users\bahadir.yalin\Desktop\Kişisel Dökümanlar\PythonWorks\fastapi\venv\lib\site-packages\pip\_vendor\resolvelib\structs.py", line 151, in __bool__
return bool(self._sequence)
File "C:\Users\bahadir.yalin\Desktop\Kişisel Dökümanlar\PythonWorks\fastapi\venv\lib\site-packages\pip\_internal\resolution\resolvelib\found_candidates.py", line 155, in __bool__
return any(self)
File "C:\Users\bahadir.yalin\Desktop\Kişisel Dökümanlar\PythonWorks\fastapi\venv\lib\site-packages\pip\_internal\resolution\resolvelib\found_candidates.py", line 143, in <genexpr>
return (c for c in iterator if id(c) not in self._incompatible_ids)
File "C:\Users\bahadir.yalin\Desktop\Kişisel Dökümanlar\PythonWorks\fastapi\venv\lib\site-packages\pip\_internal\resolution\resolvelib\found_candidates.py", line 47, in _iter_built
candidate = func()
File "C:\Users\bahadir.yalin\Desktop\Kişisel Dökümanlar\PythonWorks\fastapi\venv\lib\site-packages\pip\_internal\resolution\resolvelib\factory.py", line 201, in _make_candidate_from_link
self._link_candidate_cache[link] = LinkCandidate(
File "C:\Users\bahadir.yalin\Desktop\Kişisel Dökümanlar\PythonWorks\fastapi\venv\lib\site-packages\pip\_internal\resolution\resolvelib\candidates.py", line 281, in __init__
super().__init__(
File "C:\Users\bahadir.yalin\Desktop\Kişisel Dökümanlar\PythonWorks\fastapi\venv\lib\site-packages\pip\_internal\resolution\resolvelib\candidates.py", line 156, in __init__
self.dist = self._prepare()
File "C:\Users\bahadir.yalin\Desktop\Kişisel Dökümanlar\PythonWorks\fastapi\venv\lib\site-packages\pip\_internal\resolution\resolvelib\candidates.py", line 225, in _prepare
dist = self._prepare_distribution()
File "C:\Users\bahadir.yalin\Desktop\Kişisel Dökümanlar\PythonWorks\fastapi\venv\lib\site-packages\pip\_internal\resolution\resolvelib\candidates.py", line 292, in _prepare_distribution
return preparer.prepare_linked_requirement(self._ireq, parallel_builds=True)
File "C:\Users\bahadir.yalin\Desktop\Kişisel Dökümanlar\PythonWorks\fastapi\venv\lib\site-packages\pip\_internal\operations\prepare.py", line 482, in prepare_linked_requirement
return self._prepare_linked_requirement(req, parallel_builds)
File "C:\Users\bahadir.yalin\Desktop\Kişisel Dökümanlar\PythonWorks\fastapi\venv\lib\site-packages\pip\_internal\operations\prepare.py", line 546, in _prepare_linked_requirement
dist = _get_prepared_distribution(
File "C:\Users\bahadir.yalin\Desktop\Kişisel Dökümanlar\PythonWorks\fastapi\venv\lib\site-packages\pip\_internal\operations\prepare.py", line 58, in _get_prepared_distribution
abstract_dist.prepare_distribution_metadata(finder, build_isolation)
File "C:\Users\bahadir.yalin\Desktop\Kişisel Dökümanlar\PythonWorks\fastapi\venv\lib\site-packages\pip\_internal\distributions\sdist.py", line 37, in prepare_distribution_metadata
self._prepare_build_backend(finder)
File "C:\Users\bahadir.yalin\Desktop\Kişisel Dökümanlar\PythonWorks\fastapi\venv\lib\site-packages\pip\_internal\distributions\sdist.py", line 57, in _prepare_build_backend
self.req.build_env = BuildEnvironment()
File "C:\Users\bahadir.yalin\Desktop\Kişisel Dökümanlar\PythonWorks\fastapi\venv\lib\site-packages\pip\_internal\build_env.py", line 97, in __init__
fp.write(
File "C:\Users\bahadir.yalin\AppData\Local\Programs\Python\Python310\lib\encodings\cp1252.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\u015f' in position 174: character maps to < undefined >
我需要帮助,因为我不能使用 FAST API
来解决该错误,因此 lib 不包含它应该包含的包。
【问题讨论】:
试试这两个:将您的终端配置为 UTF-8 并尝试将您的文件夹重命名为不包含特殊字符。 【参考方案1】:“Kişisel Dökümanlar”包含许多土耳其特殊字符,例如“ş”、“ö”和“ü”。因此,您有编码问题。作为一种解决方法,您可以使用另一个目录。
【讨论】:
以上是关于我无法将 fastapi 安装到 VSC的主要内容,如果未能解决你的问题,请参考以下文章
将 pandas 数据帧传递给 FastAPI 用于 NLP ML