报错error: error: subprocess-exited-with-error metadata-generation-failed
这将为当前的命令行会话设置环境变量,然后尝试安装petname包。
·
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [6 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\99063\AppData\Local\Temp\pip-install-m19ygp5b\petname_da7e83bcaaec45a2abef2f2acf3fcbd4\setup.py", line 23, in <module>
long_description = fh.read()
UnicodeDecodeError: 'gbk' codec can't decode byte 0x92 in position 34: 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.
解决办法
您遇到的错误是UnicodeDecodeError,这是由于gbk编码无法解码setup.py文件中的某个字节序列导致的。这可能是因为该文件包含了与gbk编码不兼容的字符。 解决此问题的一个可能方法是将Python的默认编码更改为utf-8。您可以通过设置PYTHONUTF8环境变量为1来实现。在运行pip安装命令之前,可以在命令行中完成此操作
set PYTHONUTF8=1
pip install petname
这将为当前的命令行会话设置环境变量,然后尝试安装petname包
更多推荐




所有评论(0)