![pip3 在 ubuntu 上对我来说坏了](https://linux22.com/image/953633/pip3%20%E5%9C%A8%20ubuntu%20%E4%B8%8A%E5%AF%B9%E6%88%91%E6%9D%A5%E8%AF%B4%E5%9D%8F%E4%BA%86.png)
我使用 Ubuntu 20.04 和 python3.8。
我决定尝试通过创建一个虚拟环境python 3 -m venv venv
,发生了以下情况:
python3 -m venv venv
Error: Command '['/root/venv/bin/python3', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1.
当您尝试通过 pip3 安装或删除包时,会出现此错误:
pip3 install django
ERROR: Exception:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/pip/_internal/cli/base_command.py", line 186, in _main
status = self.run(options, args)
File "/usr/lib/python3/dist-packages/pip/_internal/commands/install.py", line 305, in run
session = self.get_default_session(options)
File "/usr/lib/python3/dist-packages/pip/_internal/cli/req_command.py", line 74, in get_default_session
self._session = self.enter_context(self._build_session(options))
File "/usr/lib/python3/dist-packages/pip/_internal/cli/req_command.py", line 84, in _build_session
session = PipSession(
File "/usr/lib/python3/dist-packages/pip/_internal/network/session.py", line 241, in __init__
self.headers["User-Agent"] = user_agent()
File "/usr/lib/python3/dist-packages/pip/_internal/network/session.py", line 132, in user_agent
zip(["name", "version", "id"], distro.linux_distribution()),
File "/usr/share/python-wheels/distro-1.4.0-py2.py3-none-any.whl/distro.py", line 122, in linux_distribution
return _distro.linux_distribution(full_distribution_name)
File "/usr/share/python-wheels/distro-1.4.0-py2.py3-none-any.whl/distro.py", line 676, in linux_distribution
self.name() if full_distribution_name else self.id(),
File "/usr/share/python-wheels/distro-1.4.0-py2.py3-none-any.whl/distro.py", line 714, in name
name = self.os_release_attr('name') \
File "/usr/share/python-wheels/distro-1.4.0-py2.py3-none-any.whl/distro.py", line 890, in os_release_attr
return self._os_release_info.get(attribute, '')
File "/usr/share/python-wheels/distro-1.4.0-py2.py3-none-any.whl/distro.py", line 552, in __get__
ret = obj.__dict__[self._fname] = self._f(obj)
File "/usr/share/python-wheels/distro-1.4.0-py2.py3-none-any.whl/distro.py", line 929, in _os_release_info
return self._parse_os_release_content(release_file)
File "/usr/share/python-wheels/distro-1.4.0-py2.py3-none-any.whl/distro.py", line 960, in _parse_os_release_content
tokens = list(lexer)
File "/usr/lib/python3.8/shlex.py", line 300, in __next__
token = self.get_token()
File "/usr/lib/python3.8/shlex.py", line 109, in get_token
raw = self.read_token()
File "/usr/lib/python3.8/shlex.py", line 140, in read_token
nextchar = self.instream.read(1)
File "/usr/lib/python3.8/codecs.py", line 322, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x99 in position 0: invalid start byte
pip3 版本是
来自 /usr/lib/python3/dist-packages/pip 的 pip 20.0.2(python 3.8)
在此之前,一切正常,我不知道发生了什么。请帮忙!