首页 > 解决方案 > pyttsx3 NameError 的 pip 安装突然失败:未定义名称“平台系统”

问题描述

我无法在 Windows 上安装 pyttsx3,当我执行 pip install pyttsx3 时出现以下错误,请帮助我,请注意我已经运行了命令 pip --upgrade setuptools

Exception:
Traceback (most recent call last):
  File "c:\users\gamer\appdata\local\programs\python\python38\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 2795, in _dep_map
    return self.__dep_map
  File "c:\users\gamer\appdata\local\programs\python\python38\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 2652, in __getattr__
    raise AttributeError(attr)
AttributeError: _DistInfoDistribution__dep_map

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\users\gamer\appdata\local\programs\python\python38\lib\site-packages\pip\basecommand.py", line 211, in main
    status = self.run(options, args)
  File "c:\users\gamer\appdata\local\programs\python\python38\lib\site-packages\pip\commands\install.py", line 294, in run
    requirement_set.prepare_files(finder)
  File "c:\users\gamer\appdata\local\programs\python\python38\lib\site-packages\pip\req\req_set.py", line 333, in prepare_files
    self._walk_req_to_install(
  File "c:\users\gamer\appdata\local\programs\python\python38\lib\site-packages\pip\req\req_set.py", line 321, in _walk_req_to_install
    more_reqs = handler(req_to_install)
  File "c:\users\gamer\appdata\local\programs\python\python38\lib\site-packages\pip\req\req_set.py", line 561, in _prepare_file
    set(req_to_install.extras) - set(dist.extras)
  File "c:\users\gamer\appdata\local\programs\python\python38\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 2774, in extras
    return [dep for dep in self._dep_map if dep]
  File "c:\users\gamer\appdata\local\programs\python\python38\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 2797, in _dep_map
    self.__dep_map = self._compute_dependencies()
  File "c:\users\gamer\appdata\local\programs\python\python38\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 2830, in _compute_dependencies
    common = frozenset(reqs_for_extra(None))
  File "c:\users\gamer\appdata\local\programs\python\python38\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 2827, in reqs_for_extra
    if req.marker_fn(override={'extra':extra}):
  File "c:\users\gamer\appdata\local\programs\python\python38\lib\site-packages\pip\_vendor\_markerlib\markers.py", line 113, in marker_fn
    return eval(compiled_marker, environment)
  File "<environment marker>", line 1, in <module>
NameError: name 'platform_system' is not defined

标签: pythonpython-3.xpippyttsx3

解决方案


尝试更新setuptools. 另外,升级pip使用pip install --upgrade pip. 并尝试以管理员身份运行该命令。


推荐阅读