问题
异常信息
C:\Users\xx>pip install weditor
WARNING: Ignoring invalid distribution -animgl (d:\python\python3109\lib\site-packages)
Looking in indexes: https://mirrors.aliyun.com/pypi/simple/
Collecting weditor
Downloading https://mirrors.aliyun.com/pypi/packages/ab/8a/dfe8a1b803ab71644140a5a6d4ce4ad8db0c6e1f92634072c4290f58193c/weditor-0.7.3.tar.gz (2.2 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.2/2.2 MB 24.9 MB/s eta 0:00:00
Installing build dependencies ... done
Getting requirements to build wheel ... done
Installing backend dependencies ... done
Preparing metadata (pyproject.toml) ... error
error: subprocess-exited-with-error
× Preparing metadata (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [22 lines of output]
Error parsing
Traceback (most recent call last):
File "C:\Users\xx\AppData\Local\Temp\pip-build-env-kew1irlq\normal\Lib\site-packages\pbr\core.py", line 105, in pbr
attrs = util.cfg_to_args(path, dist.script_args)
File "C:\Users\xx\AppData\Local\Temp\pip-build-env-kew1irlq\normal\Lib\site-packages\pbr\util.py", line 272, in cfg_to_args
pbr.hooks.setup_hook(config)
File "C:\Users\xx\AppData\Local\Temp\pip-build-env-kew1irlq\normal\Lib\site-packages\pbr\hooks\__init__.py", line 25, in setup_hook
metadata_config.run()
File "C:\Users\xx\AppData\Local\Temp\pip-build-env-kew1irlq\normal\Lib\site-packages\pbr\hooks\base.py", line 27, in run
self.hook()
File "C:\Users\xx\AppData\Local\Temp\pip-build-env-kew1irlq\normal\Lib\site-packages\pbr\hooks\metadata.py", line 25, in hook
self.config['version'] = packaging.get_version(
File "C:\Users\xx\AppData\Local\Temp\pip-build-env-kew1irlq\normal\Lib\site-packages\pbr\packaging.py", line 854, in get_version
version = _get_version_from_pkg_metadata(package_name)
File "C:\Users\xx\AppData\Local\Temp\pip-build-env-kew1irlq\normal\Lib\site-packages\pbr\packaging.py", line 822, in _get_version_from_pkg_metadata
pkg_metadata = email.message_from_file(pkg_metadata_file)
File "D:\Python\Python3109\lib\email\__init__.py", line 54, in message_from_file
return Parser(*args, **kws).parse(fp)
File "D:\Python\Python3109\lib\email\parser.py", line 53, in parse
data = fp.read(8192)
UnicodeDecodeError: 'gbk' codec can't decode byte 0xad in position 795: illegal multibyte sequence
error in setup command: Error parsing C:\Users\xx\AppData\Local\Temp\pip-install-h83r38_5\weditor_1a095d35f6d746869f3d2cc69d4ac6eb\setup.cfg: UnicodeDecodeError: 'gbk' codec can't decode byte 0xad in position 795: illegal multibyte sequence
[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.
解决方案
方案一: 降版本,pip install weditor==0.6.4
方案二:在cmd窗口输入set PYTHONUTF8=1,表示启用python环境编码为utf-8模式,然后再尝试pip install weditor即可安装成功最新版
Successfully installed Deprecated-1.2.14 adbutils-2.8.0 apkutils2-1.0.0 cached-property-1.5.2 cigam-0.0.3 construct-2.10.70 deprecation-2.1.0 facebook-wda-1.4.9 logzero-1.7.0 lxml-5.3.0 py-1.11.0 pyelftools-0.31 retry-0.9.2 tornado-6.4.1 uiautomator2-3.2.5 weditor-0.7.3 wrapt-1.16.0 xmltodict-0.14.2