janten/dpt-rp1-py

pip3 install dpt-rp1-py报错,请大神们帮忙看下

eshion opened this issue · 1 comments

PS C:\Users\eshion>pip3 install dpt-rp1-py
Collecting dpt-rp1-py
Using cached dpt-rp1-py-0.1.11.tar.gz (28 kB)
ERROR: Command errored out with exit status 1:
command: 'C:\Users\eshion\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\eshion\AppData\Local\Temp\pip-install-svitqk_8\dpt-rp1-py\setup.py'"'"'; file='"'"'C:\Users\eshion\AppData\Local\Temp\pip-install-svitqk_8\dpt-rp1-py\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\eshion\AppData\Local\Temp\pip-pip-egg-info-f7qtiap4'
cwd: C:\Users\eshion\AppData\Local\Temp\pip-install-svitqk_8\dpt-rp1-py
Complete output (7 lines):
Traceback (most recent call last):
File "", line 1, in
File "C:\Users\eshion\AppData\Local\Temp\pip-install-svitqk_8\dpt-rp1-py\setup.py", line 51, in
long_description=readme(),
File "C:\Users\eshion\AppData\Local\Temp\pip-install-svitqk_8\dpt-rp1-py\setup.py", line 27, in readme
return f.read()
UnicodeDecodeError: 'gbk' codec can't decode byte 0xa6 in position 1950: illegal multibyte sequence
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Under windows with Chinese, python will try to read the file with GBK when encoding is not assigned., but the README.md file is created under UTF-8. That caused the error you mentioned.
Please download the source file, try changing the setup.py in the root folder

def readme():
    with open(os.path.join(DIRECTORY, "README.md")) as f:
        return f.read()

to

def readme():
    with open(os.path.join(DIRECTORY, "README.md"),encoding = 'UTF-8') as f:
        return f.read()

And avoid installing them into a folder with Chinese character.
You may install under the README.md's instruction, which is pip3 install .
If this worked, you can create a pull request.
When you edited the README.md, setup.py or any other codes, please save it with Unicode, not GBK 18030.


中文windows环境下的python默认会用GBK编码来读文件。但是这个README.md是以UTF-8保存的。这样就导致了你看到的那些错误。
请下载这个存储库,并将根目录的 setup.py

def readme():
    with open(os.path.join(DIRECTORY, "README.md")) as f:
        return f.read()

改成

def readme():
    with open(os.path.join(DIRECTORY, "README.md"),encoding = 'UTF-8') as f:
        return f.read()

在不要安装到有中文字符的目录。
您可以按照README.md里面的内容来安装它。也就是说,pip3 install .
如果这样可行,请您提出pull request,来帮助其它的本地化用户。
如果您要修改任何文件,请您用Unicode编码,而不是GBK-18030来保存。