python安装weditor报错

在cmd命令中安装weditor出现下面情况,安装不成功

Collecting progress~=1.3 (from uiautomator2>=2.10.1->weditor==0.6.4)
  Using cached progress-1.6.tar.gz (7.8 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [14 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "C:\Users\Yu7\AppData\Local\Temp\pip-install-26bq4h5p\progress_fbd84c70f0c94af3988bba6aa4708ac8\setup.py", line 8, in <module>
          setup(
        File "D:\python_step\lib\site-packages\setuptools\__init__.py", line 106, in setup
          _install_setup_requires(attrs)
        File "D:\python_step\lib\site-packages\setuptools\__init__.py", line 74, in _install_setup_requires
          dist = MinimalDistribution(attrs)
        File "D:\python_step\lib\site-packages\setuptools\__init__.py", line 56, in __init__
          super().__init__(filtered)
        File "D:\python_step\lib\site-packages\setuptools\dist.py", line 494, in __init__
          for ep in metadata.entry_points(group='distutils.setup_keywords'):
      TypeError: entry_points() got an unexpected keyword argument 'group'
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

1.降低版本试过了也是安装不了

该回答引用ChatGPT4与博主@晓码自在合作编写:

从错误信息来看,这是一个第三方包 progress 的安装问题,导致 weditor 无法安装。

有几个想法可以试试:

  1. 升级 pip 和 setuptools,然后重试。有时版本过低会导致依赖RESOLUTION问题。
python -m pip install --upgrade pip setuptools 

  1. 使用 --no-cache-dir 选项重新安装,清除缓存的软件包。
pip install weditor --no-cache-dir

  1. 卸载系统已有的 progress 包,然后重新安装 weditor。
pip uninstall progress
pip install weditor

  1. 下载 progress 的 whl 文件,并本地安装。然后再安装 weditor。

你可以在 https://www.lfd.uci.edu/~gohlke/pythonlibs/#progress 找到适用于你 Python 版本的 progress whl 文件。然后:

pip install progress‐1.6‐py3‐none‐any.whl
pip install weditor

  1. 如果以上方法都不行,你可以尝试使用虚拟环境来安装 weditor。
python -m venv venv
venv\Scripts\activate  # Windows 
source venv/bin/activate  # Mac/Linux
pip install weditor

在虚拟环境中安装,可以避免与系统 Python 产生依赖等冲突问题。

这些是解决 Python 包安装问题的常用方法。根据你的错误信息,progress 这个依赖包很可能是造成问题的根源。所以重点还是围绕这个包进行尝试。