weditor 0.6.5版本安装报 'gbk' codec can't decode byte 0xad in position
pip安装或者更新 weditor到最新的0.6.5版本时会报错,如下:
C:\Users\>pip install weditor Collecting weditor Using cached weditor-0.6.5.tar.gz (2.2 MB) Preparing metadata (setup.py) ... error error: subprocess-exited-with-error × python setup.py egg_info did not run successfully. │ exit code: 1 ╰─> [31 lines of output] D:\Program Files\Python310\lib\site-packages\setuptools\dist.py:771: UserWarning: Us age of dash-separated 'author-email' will not be supported in future versions. Please use the underscore name 'author_email' instead warnings.warn( D:\Program Files\Python310\lib\site-packages\setuptools\dist.py:771: UserWarning: Us age of dash-separated 'home-page' will not be supported in future versions. Please use the underscore name 'home_page' instead warnings.warn( D:\Program Files\Python310\lib\site-packages\setuptools\dist.py:771: UserWarning: Us age of dash-separated 'description-file' will not be supported in future versions. Please use the underscore name 'description_file' instead warnings.warn( D:\Program Files\Python310\lib\site-packages\setuptools\installer.py:27: SetuptoolsD eprecationWarning: setuptools.installer is deprecated. Requirements should be satisfied by a PEP 517 installer. warnings.warn( WARNING: The wheel package is not available. Error parsing Traceback (most recent call last): File "c:\users\appdata\local\temp\pip-install-f_m3zqhx\weditor_47fc0 c0ffd38477f9e75df1e56cb0d5a\.eggs\pbr-5.9.0-py3.10.egg\pbr\core.py", line 111, in pbr attrs = util.cfg_to_args(path, dist.script_args) File "c:\users\appdata\local\temp\pip-install-f_m3zqhx\weditor_47fc0 c0ffd38477f9e75df1e56cb0d5a\.eggs\pbr-5.9.0-py3.10.egg\pbr\util.py", line 272, in cfg_to_a rgs pbr.hooks.setup_hook(config) File "c:\users\appdata\local\temp\pip-install-f_m3zqhx\weditor_47fc0 c0ffd38477f9e75df1e56cb0d5a\.eggs\pbr-5.9.0-py3.10.egg\pbr\hooks\__init__.py", line 25, in setup_hook metadata_config.run() File "c:\users\appdata\local\temp\pip-install-f_m3zqhx\weditor_47fc0 c0ffd38477f9e75df1e56cb0d5a\.eggs\pbr-5.9.0-py3.10.egg\pbr\hooks\base.py", line 27, in run self.hook() File "c:\users\appdata\local\temp\pip-install-f_m3zqhx\weditor_47fc0 c0ffd38477f9e75df1e56cb0d5a\.eggs\pbr-5.9.0-py3.10.egg\pbr\hooks\metadata.py", line 25, in hook self.config['version'] = packaging.get_version( File "c:\users\appdata\local\temp\pip-install-f_m3zqhx\weditor_47fc0 c0ffd38477f9e75df1e56cb0d5a\.eggs\pbr-5.9.0-py3.10.egg\pbr\packaging.py", line 860, in get _version version = _get_version_from_pkg_metadata(package_name) File "c:\users\appdata\local\temp\pip-install-f_m3zqhx\weditor_47fc0 c0ffd38477f9e75df1e56cb0d5a\.eggs\pbr-5.9.0-py3.10.egg\pbr\packaging.py", line 828, in _ge t_version_from_pkg_metadata pkg_metadata = email.message_from_file(pkg_metadata_file) File "D:\Program Files\Python310\lib\email\__init__.py", line 54, in message_from_ file return Parser(*args, **kws).parse(fp) File "D:\Program Files\Python310\lib\email\parser.py", line 53, in parse data = fp.read(8192) UnicodeDecodeError: 'gbk' codec can't decode byte 0xad in position 825: illegal mult ibyte sequence error in setup command: Error parsing C:\Users\AppData\Local\Temp\pip- install-f_m3zqhx\weditor_47fc0c0ffd38477f9e75df1e56cb0d5a\setup.cfg: UnicodeDecodeError: ' gbk' codec can't decode byte 0xad in position 825: 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.
解决办法:
设置环境变量,在命令窗口中执行:
set PYTHONUTF8=1
然后再次执行pip install weditor==0.6.5 或者 pip install --upgrade weditor,则可正常成功
C:\Users>pip install --upgrade weditor Requirement already satisfied: weditor in d:\program files\python310\lib\site-packages (0.6.4) Collecting weditor Using cached weditor-0.6.5.tar.gz (2.2 MB) Preparing metadata (setup.py) ... done Requirement already satisfied: tornado>=4.3 in d:\program files\python310\lib\site-packages (from weditor) (6.2) Requirement already satisfied: six in d:\program files\python310\lib\site-packages (from weditor) (1.16.0) Requirement already satisfied: pillow in d:\program files\python310\lib\site-packages (from weditor) (9.2.0) Requirement already satisfied: logzero in d:\program files\python310\lib\site-packages (from weditor) (1.7.0) Requirement already satisfied: cached_property in d:\program files\python310\lib\site-packages (from weditor) (1.5.2) Requirement already satisfied: pywin32 in d:\program files\python310\lib\site-packages (from weditor) (304) Requirement already satisfied: uiautomator2>=2.10.1 in d:\program files\python310\lib\site-packages (from weditor) (2.16.17) Requirement already satisfied: facebook-wda>=1.0.5 in d:\program files\python310\lib\site-packages (from weditor) (1.4.6) Requirement already satisfied: Deprecated~=1.2.6 in d:\program files\python310\lib\site-packages (from facebook-wda>=1.0.5->weditor) (1.2.13) Requirement already satisfied: retry in d:\program files\python310\lib\site-packages (from facebook-wda>=1.0.5->weditor) (0.9.2) Requirement already satisfied: requests>=2.9.1 in d:\program files\python310\lib\site-packages (from facebook-wda>=1.0.5->weditor) (2.28.1) Requirement already satisfied: adbutils>=0.11.0 in d:\program files\python310\lib\site-packages (from uiautomator2>=2.10.1->weditor) (1.0.1) Requirement already satisfied: progress~=1.3 in d:\program files\python310\lib\site-packages (from uiautomator2>=2.10.1->weditor) (1.6) Requirement already satisfied: filelock<4.0,>=3.0.12 in d:\program files\python310\lib\site-packages (from uiautomator2>=2.10.1->weditor) (3.7.1) Requirement already satisfied: packaging~=20.3 in d:\program files\python310\lib\site-packages (from uiautomator2>=2.10.1->weditor) (20.9) Requirement already satisfied: whichcraft in d:\program files\python310\lib\site-packages (from uiautomator2>=2.10.1->weditor) (0.6.1) Requirement already satisfied: lxml>=4.3 in d:\program files\python310\lib\site-packages (from uiautomator2>=2.10.1->weditor) (4.9.1) Requirement already satisfied: colorama in d:\program files\python310\lib\site-packages (from logzero->weditor) (0.4.5) Requirement already satisfied: apkutils2<2.0,>=1.0.0 in d:\program files\python310\lib\site-packages (from adbutils>=0.11.0->uiautomator2>=2.10.1->weditor) (1.0.0) Requirement already satisfied: deprecation<3.0,>=2.0.6 in d:\program files\python310\lib\site-packages (from adbutils>=0.11.0->uiautomator2>=2.10.1->weditor) (2.1.0) Requirement already satisfied: wrapt<2,>=1.10 in d:\program files\python310\lib\site-packages (from Deprecated~=1.2.6->facebook-wda>=1.0.5->weditor) (1.14.1) Requirement already satisfied: pyparsing>=2.0.2 in d:\program files\python310\lib\site-packages (from packaging~=20.3->uiautomator2>=2.10.1->weditor) (3.0.9) Requirement already satisfied: urllib3<1.27,>=1.21.1 in d:\program files\python310\lib\site-packages (from requests>=2.9.1->facebook-wda>=1.0.5->weditor) (1.26.10) Requirement already satisfied: certifi>=2017.4.17 in d:\program files\python310\lib\site-packages (from requests>=2.9.1->facebook-wda>=1.0.5->weditor) (2022.6.15) Requirement already satisfied: charset-normalizer<3,>=2 in d:\program files\python310\lib\site-packages (from requests>=2.9.1->facebook-wda>=1.0.5->weditor) (2.1.0) Requirement already satisfied: idna<4,>=2.5 in d:\program files\python310\lib\site-packages (from requests>=2.9.1->facebook-wda>=1.0.5->weditor) (3.3) Requirement already satisfied: py<2.0.0,>=1.4.26 in d:\program files\python310\lib\site-packages (from retry->facebook-wda>=1.0.5->weditor) (1.11.0) Requirement already satisfied: decorator>=3.4.2 in d:\program files\python310\lib\site-packages (from retry->facebook-wda>=1.0.5->weditor) (5.1.1) Requirement already satisfied: pyelftools in d:\program files\python310\lib\site-packages (from apkutils2<2.0,>=1.0.0->adbutils>=0.11.0->uiautomator2>=2.10.1->weditor) (0.28) Requirement already satisfied: cigam in d:\program files\python310\lib\site-packages (from apkutils2<2.0,>=1.0.0->adbutils>=0.11.0->uiautomator2>=2.10.1->weditor) (0.0.3) Requirement already satisfied: xmltodict in d:\program files\python310\lib\site-packages (from apkutils2<2.0,>=1.0.0->adbutils>=0.11.0->uiautomator2>=2.10.1->weditor) (0.13.0) Using legacy 'setup.py install' for weditor, since package 'wheel' is not installed. Installing collected packages: weditor Attempting uninstall: weditor Found existing installation: weditor 0.6.4 Uninstalling weditor-0.6.4: Successfully uninstalled weditor-0.6.4 Running setup.py install for weditor ... done Successfully installed weditor-0.6.5 C:\Users>