无法通过pip install
或安装任何东西pip3 install
,它会引发以下错误:
Exception:
Traceback (most recent call last):
File "/usr/lib/python3.7/site-packages/pip/_internal/cli/base_command.py", line 179, in main
status = self.run(options, args)
File "/usr/lib/python3.7/site-packages/pip/_internal/commands/install.py", line 255, in run
with self._build_session(options) as session:
File "/usr/lib/python3.7/site-packages/pip/_internal/cli/base_command.py", line 93, in _build_session
insecure_hosts=options.trusted_hosts,
File "/usr/lib/python3.7/site-packages/pip/_internal/download.py", line 344, in __init__
self.headers["User-Agent"] = user_agent()
File "/usr/lib/python3.7/site-packages/pip/_internal/download.py", line 108, in user_agent
zip(["name", "version", "id"], distro.linux_distribution()),
File "/usr/lib/python3.7/site-packages/distro.py", line 122, in linux_distribution
return _distro.linux_distribution(full_distribution_name)
File "/usr/lib/python3.7/site-packages/distro.py", line 677, in linux_distribution
self.version(),
File "/usr/lib/python3.7/site-packages/distro.py", line 737, in version
self.lsb_release_attr('release'),
File "/usr/lib/python3.7/site-packages/distro.py", line 899, in lsb_release_attr
return self._lsb_release_info.get(attribute, '')
File "/usr/lib/python3.7/site-packages/distro.py", line 552, in __get__
ret = obj.__dict__[self._fname] = self._f(obj)
File "/usr/lib/python3.7/site-packages/distro.py", line 1012, in _lsb_release_info
stdout = subprocess.check_output(cmd, stderr=devnull)
File "/usr/lib/python3.7/subprocess.py", line 395, in check_output
**kwargs).stdout
File "/usr/lib/python3.7/site-packages/run/__init__.py", line 145, in __new__
process = cls.create_process(command, stdin, cwd=cwd, env=env, shell=shell)
File "/usr/lib/python3.7/site-packages/run/__init__.py", line 121, in create_process
shlex.split(command),
File "/usr/lib/python3.7/shlex.py", line 305, in split
return list(lex)
File "/usr/lib/python3.7/shlex.py", line 295, in __next__
token = self.get_token()
File "/usr/lib/python3.7/shlex.py", line 105, in get_token
raw = self.read_token()
File "/usr/lib/python3.7/shlex.py", line 136, in read_token
nextchar = self.instream.read(1)
AttributeError: 'tuple' object has no attribute 'read'
我在 Manjaro Linux 上使用 KDE。如果需要,请提供更多信息:
NAME="Manjaro Linux"
ID=manjaro
ID_LIKE=arch
PRETTY_NAME="Manjaro Linux"
ANSI_COLOR="1;32"
HOME_URL="https://www.manjaro.org/"
SUPPORT_URL="https://www.manjaro.org/"
BUG_REPORT_URL="https://bugs.manjaro.org/"
答案1
我在网上搜索并发现了以下有用的信息。
https://pip.pypa.io/en/latest/installing/
https://www.tecmint.com/install-pip-in-Linux/
信息表明,正确的 pip 功能需要一些额外要求。此外,还指出 get-pip.py 与某些操作系统不兼容。
答案2
你的 Python 安装因该subprocess.run
软件包而崩溃。如果你已subprocess.run
通过安装pip
,请将其卸载:
sudo pip3.7 uninstall subprocess.run
如果你没有明确安装它,请找出哪个包拥有该代码:
pacman -Qo /usr/lib/python3.7/site-packages/run/__init__.py
然后卸载它:
sudo pacman -R pkgname
与包相关的问题subprocess.run
(未解决):https://github.com/xando/subprocess.run/issues/5