||
在安装好Python3.8以后,并解决_ssl问题以后,开始安装pipenv,出现如下问题:
ERROR: Exception:
Traceback (most recent call last):
File "/usr/local/python3/lib/python3.8/site-packages/pip/_internal/cli/base_command.py", line 188, in _main
status = self.run(options, args)
File "/usr/local/python3/lib/python3.8/site-packages/pip/_internal/commands/uninstall.py", line 54, in run
session = self.get_default_session(options)
File "/usr/local/python3/lib/python3.8/site-packages/pip/_internal/cli/req_command.py", line 83, in get_default_session
self._session = self.enter_context(self._build_session(options))
File "/usr/local/python3/lib/python3.8/site-packages/pip/_internal/cli/req_command.py", line 93, in _build_session
session = PipSession(
File "/usr/local/python3/lib/python3.8/site-packages/pip/_internal/network/session.py", line 249, in __init__
self.headers["User-Agent"] = user_agent()
File "/usr/local/python3/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/python3/lib/python3.8/site-packages/pip/_vendor/distro.py", line 125, in linux_distribution
return _distro.linux_distribution(full_distribution_name)
File "/usr/local/python3/lib/python3.8/site-packages/pip/_vendor/distro.py", line 681, in linux_distribution
self.version(),
File "/usr/local/python3/lib/python3.8/site-packages/pip/_vendor/distro.py", line 741, in version
self.lsb_release_attr('release'),
File "/usr/local/python3/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/python3/lib/python3.8/site-packages/pip/_vendor/distro.py", line 556, in __get__
ret = obj.__dict__[self._fname] = self._f(obj)
File "/usr/local/python3/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/python3/lib/python3.8/subprocess.py", line 411, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "/usr/local/python3/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.
这个原因是因为电脑默认的Python3版本是3.4,安装3.8版本覆盖了3.4版本,导致系统默认的很多包无法使用;因此必须恢复之前的版本,然后重新安装3.8(不能覆盖/usr/local/python3这个目录,重新建一个目录/usr/local/python3.8)
如果不知道系统默认的Python3版本,可以利用
whereis python #查看Python所在的所有目录,里面能看到除了2.7半以后的3版本
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2024-9-1 09:26
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社