我在搞乱python3和pip,一些包似乎损坏了一些python文件,我在尝试使用pip时遇到了这个错误和其他一些错误:
Exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/pip/basecommand.py", line 209, in main
status = self.run(options, args)
File "/usr/local/lib/python3.8/dist-packages/pip/commands/install.py", line 249, in run
with self._build_session(options) as session:
File "/usr/local/lib/python3.8/dist-packages/pip/basecommand.py", line 66, in _build_session
session = PipSession(
File "/usr/local/lib/python3.8/dist-packages/pip/download.py", line 321, in __init__
self.headers["User-Agent"] = user_agent()
File "/usr/local/lib/python3.8/dist-packages/pip/download.py", line 93, in user_agent
zip(["name", "version", "id"], platform.linux_distribution()),
AttributeError: module 'platform' has no attribute 'linux_distribution'
Traceback (most recent call last):
File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/usr/local/lib/python3.8/dist-packages/pip/__main__.py", line 19, in <module>
sys.exit(pip.main())
File "/usr/local/lib/python3.8/dist-packages/pip/__init__.py", line 217, in main
return command.main(cmd_args)
File "/usr/local/lib/python3.8/dist-packages/pip/basecommand.py", line 242, in main
with self._build_session(
File "/usr/local/lib/python3.8/dist-packages/pip/basecommand.py", line 66, in _build_session
session = PipSession(
File "/usr/local/lib/python3.8/dist-packages/pip/download.py", line 321, in __init__
self.headers["User-Agent"] = user_agent()
File "/usr/local/lib/python3.8/dist-packages/pip/download.py", line 93, in user_agent
zip(["name", "version", "id"], platform.linux_distribution()),
AttributeError: module 'platform' has no attribute 'linux_distribution'
我在相关问题上使用建议的方法尝试了几个小时,但没有一个有帮助
基于一些线程,你不应该删除python3.8,因为很多系统资源都在使用它,那么我怎样才能修复它的所有文件并重新安装呢?我希望它基本上恢复为默认值并删除所有已安装的软件包,我该怎么做?
您不必删除
python3
. 它只会让事情变得更糟。相反,pip
请按照以下命令删除并重新安装它。