debian10环境[omv], 更新python版本,从3.7.3升级到3.8.7后,
执行pip 安装包时报以下错误,
Traceback (most recent call last):
File "/usr/local/bin/pip", line 8, in
sys.exit(main())
File "/usr/local/lib/python3.8/site-packages/pip/_internal/cli/main.py", line 75, in main
return command.main(cmd_args)
File "/usr/local/lib/python3.8/site-packages/pip/_internal/cli/base_command.py", line 121, in main
return self._main(args)
File "/usr/local/lib/python3.8/site-packages/pip/_internal/cli/base_command.py", line 265, in _main
self.handle_pip_version_check(options)
File "/usr/local/lib/python3.8/site-packages/pip/_internal/cli/req_command.py", line 149, in handle_pip_version_check
session = self._build_session(
File "/usr/local/lib/python3.8/site-packages/pip/_internal/cli/req_command.py", line 90, in _build_session
session = PipSession(
File "/usr/local/lib/python3.8/site-packages/pip/_internal/network/session.py", line 249, in init
self.headers["User-Agent"] = user_agent()
File "/usr/local/lib/python3.8/site-packages/pip/_internal/network/session.py", line 132, in user_agent
zip(["name", "version", "id"], distro.linux_distribution()),
File "/usr/local/lib/python3.8/site-packages/pip/_vendor/distro.py", line 125, in linux_distribution
return _distro.linux_distribution(full_distribution_name)
File "/usr/local/lib/python3.8/site-packages/pip/_vendor/distro.py", line 681, in linux_distribution
self.version(),
File "/usr/local/lib/python3.8/site-packages/pip/_vendor/distro.py", line 741, in version
self.lsb_release_attr('release'),
File "/usr/local/lib/python3.8/site-packages/pip/_vendor/distro.py", line 903, in lsb_release_attr
return self._lsb_release_info.get(attribute, '')
File "/usr/local/lib/python3.8/site-packages/pip/_vendor/distro.py", line 556, in get
ret = obj.dict[self._fname] = self._f(obj)
File "/usr/local/lib/python3.8/site-packages/pip/_vendor/distro.py", line 1014, in _lsb_release_info
stdout = subprocess.check_output(cmd, stderr=devnull)
File "/usr/local/lib/python3.8/subprocess.py", line 411, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "/usr/local/lib/python3.8/subprocess.py", line 512, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '('lsb_release', '-a')' returned non-zero exit status 1.
定位到最终的错误为 lsb_release
打开/usr/bin/lsb_release,修改第一行
#原第一行代码如下
#!/usr/bin/python3. -Es
#修改为如下
#!/usr/bin/python3.8 -Es