Python 3.x pip3安装cbor2时抛出UnicodeDecodeError
可能与docker无关:我正在尝试在docker容器中安装两个python包。Python 3.x pip3安装cbor2时抛出UnicodeDecodeError,python-3.x,docker,ubuntu,pip,Python 3.x,Docker,Ubuntu,Pip,可能与docker无关:我正在尝试在docker容器中安装两个python包。 我的主机是Raspberry Pi 4,Docker Base映像是Ubuntu 18.04 主机:Raspberry Pi 4,Linux raspberrypi 5.4.51-v7l+armv7l GNU/Linux Docker基本图像:ubuntu:18.04 我已经使用just-apt-get安装了python RUN apt-get update & apt-get install -y p
我的主机是Raspberry Pi 4,Docker Base映像是Ubuntu 18.04
- 主机:Raspberry Pi 4,
Linux raspberrypi 5.4.51-v7l+armv7l GNU/Linux
- Docker基本图像:
ubuntu:18.04
RUN apt-get update & apt-get install -y python3-dev python3-pip ...
对于安装包,我使用常规的pip命令
RUN python3 -m pip install <packages>
这似乎只是python3.6(Ubuntu18.04的默认python3版本)的问题。
如果我手动编译和安装python 3.8版,它似乎工作得很好。有人使用python 3.6解决了这个错误吗?我希望避免编译Python3.8,因为我使用的是RPIzero,而且编译这个过程花费的时间太长。
同样,升级到Ubuntu 20.04也是不可能的,因为docker和Ubuntu 20.04似乎都有我怀疑问题在于文件中的非ascii字符。此处讨论了该错误:。如果需要,请尝试重新打开它。或者将区域设置更改为
C.utf-8
。似乎不起作用:步骤4/18:运行区域设置gen C.utf-8-->Running in。。。错误:“C.utf-8”不是受支持的语言或区域设置
我现在暂时使用我在回答中给出的链接中的变通方法,使用ubuntu 20.04C.utf-8
,en_US.utf8
,等等…en_US.utf8
已经尝试过了,但显然没有效果。。。(得到相同的错误)我怀疑问题在于中的非ascii字符。此处讨论了该错误:。如果需要,请尝试重新打开它。或者将区域设置更改为C.utf-8
。似乎不起作用:步骤4/18:运行区域设置gen C.utf-8-->Running in。。。错误:“C.utf-8”不是受支持的语言或区域设置
我现在暂时使用我在回答中给出的链接中的变通方法,使用ubuntu 20.04C.utf-8
,en_US.utf8
,等等…en_US.utf8
已经尝试过了,但显然没有效果。。。(得到相同的错误)
...
Collecting cbor2
Downloading cbor2-5.1.2.tar.gz (73 kB)
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-o2fkfon2/cbor2/setup.py'"'"'; __file__='"'"'/tmp/pip-install-o2fkfon2/cbor2/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 /tmp/pip-pip-egg-info-z3eibmqi
cwd: /tmp/pip-install-o2fkfon2/cbor2/
Complete output (19 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-o2fkfon2/cbor2/setup.py", line 68, in <module>
**kwargs
File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 128, in setup
_install_setup_requires(attrs)
File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 121, in _install_setup_requires
dist.parse_config_files(ignore_option_errors=True)
File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 491, in parse_config_files
_Distribution.parse_config_files(self, filenames=filenames)
File "/usr/lib/python3.6/distutils/dist.py", line 395, in parse_config_files
parser.read(filename)
File "/usr/lib/python3.6/configparser.py", line 697, in read
self._read(fp, filename)
File "/usr/lib/python3.6/configparser.py", line 1015, in _read
for lineno, line in enumerate(fp, start=1):
File "/usr/lib/python3.6/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 149: ordinal not in range(128)
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.