How to reinstall or repair python3.8 safely in ubuntu 20.04 and revert all of its files back to default?
7,929
You need not have to remove python3
. It will just make the matters worse.
Instead, remove pip
and install it again following the command below.
sudo apt remove python3-pip
sudo python3.8 -m easy_install pip
Related videos on Youtube
Author by
OneAndOnly
Updated on September 18, 2022Comments
-
OneAndOnly almost 2 years
I was messing around with python3 and pip, and some packages seem to have corrupted some of the python files, i am getting this error and some others when trying to use 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'
I tried hours using the suggested methods on related questions but non of them helped
based on some threads, you should not remove python3.8 because many system resources use it, so how can i repair all of it files and reinstall it? i want it to basically revert back to default and remove all the installed packages, how can i do it?
-
OneAndOnly over 3 yearsSo lets say some python files got corrupted for some reason, then i can't even repair the python itself?
-
Tejas Lotlikar over 3 yearsYou can check this answer askubuntu.com/a/448927/890892