欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Python3安装核心价值观包报错

程序员文章站 2022-05-31 07:57:56
...

当我使用命令安装核心价值观包时出现了编码问题

D:\Language_Env\Python3\Lib\site-packages\cve-1.0.1>python setup.py install
Traceback (most recent call last):
  File "setup.py", line 5, in <module>
    long_description = f.read().encode('gbk')
UnicodeDecodeError: 'gbk' codec can't decode byte 0x80 in position 22: illegal multibyte sequence

这时候打开setup.py查看一下

from setuptools import setup


with open('README.md', mode='r') as f:
    long_description = f.read()

setup(
    packages=['cve'],
    name='cve',
    entry_points={'console_scripts': ['cve=cve.command:main']},
    version='1.0.1',
    description='core socialist values encoding',
    long_description=long_description,
    long_description_content_type='text/markdown',
    author='chemf',
    author_email='[email protected]',
    url='https://github.com/feng409/core-values-encoder',
)

发现第五行是一个读文件的操作,而这个文件中的字符是中文的,暴力解决方法就是把涉及到这个文件和变量的操作全部注释掉

from setuptools import setup


# with open('README.md', mode='r') as f:
#     long_description = f.read()

setup(
    packages=['cve'],
    name='cve',
    entry_points={'console_scripts': ['cve=cve.command:main']},
    version='1.0.1',
    description='core socialist values encoding',
    # long_description=long_description,
    long_description_content_type='text/markdown',
    author='chemf',
    author_email='[email protected]',
    url='https://github.com/feng409/core-values-encoder',
)

然后再次安装,发现安装成功

 

相关标签: cmd python python