web-editor
web-editor copied to clipboard
'gbk' codec error
C:\Users\EggBro>pip install -U weditor
Looking in indexes: https://mirrors.aliyun.com/pypi/simple/
Collecting weditor
Using cached https://mirrors.aliyun.com/pypi/packages/04/9b/ec6c2b8ab08fecd21d98121e2b91244632d1836669bb9c917ff01406bd1a/weditor-0.6.5.tar.gz (2.2 MB)
ERROR: Command errored out with exit status 1:
command: 'C:\Anaconda3\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\EggBro\AppData\Local\Temp\pip-install-67qx_6wx\weditor\setup.py'"'"'; file='"'"'C:\Users\EggBro\AppData\Local\Temp\pip-install-67qx_6wx\weditor\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\EggBro\AppData\Local\Temp\pip-install-67qx_6wx\weditor\pip-egg-info'
cwd: C:\Users\EggBro\AppData\Local\Temp\pip-install-67qx_6wx\weditor
Complete output (22 lines):
ERROR:root:Error parsing
Traceback (most recent call last):
File "c:\users\eggbro\appdata\local\temp\pip-install-67qx_6wx\weditor.eggs\pbr-5.8.1-py3.7.egg\pbr\core.py", line 111, in pbr
attrs = util.cfg_to_args(path, dist.script_args)
File "c:\users\eggbro\appdata\local\temp\pip-install-67qx_6wx\weditor.eggs\pbr-5.8.1-py3.7.egg\pbr\util.py", line 272, in cfg_to_args
pbr.hooks.setup_hook(config)
File "c:\users\eggbro\appdata\local\temp\pip-install-67qx_6wx\weditor.eggs\pbr-5.8.1-py3.7.egg\pbr\hooks_init_.py", line 25, in setup_hook
metadata_config.run()
File "c:\users\eggbro\appdata\local\temp\pip-install-67qx_6wx\weditor.eggs\pbr-5.8.1-py3.7.egg\pbr\hooks\base.py", line 27, in run
self.hook()
File "c:\users\eggbro\appdata\local\temp\pip-install-67qx_6wx\weditor.eggs\pbr-5.8.1-py3.7.egg\pbr\hooks\metadata.py", line 26, in hook
self.config['name'], self.config.get('version', None))
File "c:\users\eggbro\appdata\local\temp\pip-install-67qx_6wx\weditor.eggs\pbr-5.8.1-py3.7.egg\pbr\packaging.py", line 860, in get_version
version = _get_version_from_pkg_metadata(package_name)
File "c:\users\eggbro\appdata\local\temp\pip-install-67qx_6wx\weditor.eggs\pbr-5.8.1-py3.7.egg\pbr\packaging.py", line 828, in get_version_from_pkg_metadata
pkg_metadata = email.message_from_file(pkg_metadata_file)
File "C:\Anaconda3\lib\email_init.py", line 54, in message_from_file
return Parser(*args, **kws).parse(fp)
File "C:\Anaconda3\lib\email\parser.py", line 53, in parse
data = fp.read(8192)
UnicodeDecodeError: 'gbk' codec can't decode byte 0xad in position 825: illegal multibyte sequence
error in setup command: Error parsing C:\Users\EggBro\AppData\Local\Temp\pip-install-67qx_6wx\weditor\setup.cfg: UnicodeDecodeError: 'gbk' codec can't decode byte 0xad in position 825: illegal multibyte sequence
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
git clone https://gitcode.net/mirrors/alibaba/web-editor
cd web-editor
python setup.py install
跟我的一样,我在pypi上下载了安装包执行本地安装同样出现这个问题。 在WIN10上容易出现编码错误。
经自己测试,两台电脑均完美解决,办法如下: 1.解压weditor的安装包。 2.找到报错的文件,全部需要修改,以下面为例:
**\weditor.eggs\pbr-5.8.1-py3.7.egg\pbr\hooks\metadata.py \weditor.eggs\pbr-5.8.1-py3.7.egg\pbr\packaging.py 打开,找到open方法,修改代码,添加encoding='utf-8', 如: with open(, 'r', encoding='utf-8')
保存, 重新执行本地安装
设置下环境变量
set PYTHONUTF8=1
pip install weditor==0.6.4 解决问题
问题根源分析,以及另外一个解决办法 : https://github.com/alibaba/web-editor/issues/145