I want to clean all traces of python from my Ubuntu. Is there any easy solution?
To start with I guess I should remove all pip packages. I tried command as suggested here, but got bunch of failure messages:
#pip3 freeze | xargs pip3 uninstall -y
Found existing installation: appdirs 1.4.4
Uninstalling appdirs-1.4.4:
Successfully uninstalled appdirs-1.4.4
Found existing installation: attrs 19.3.0
Not uninstalling attrs at /usr/lib/python3/dist-packages, outside environment /usr
Can't uninstall 'attrs'. No files were found to uninstall.
Found existing installation: Automat 0.8.0
Not uninstalling automat at /usr/lib/python3/dist-packages, outside environment /usr
Can't uninstall 'Automat'. No files were found to uninstall.
...
What should I do? This answer asks to run:
sudo rm -rf /usr/local/lib/python2.7/dist-packages/twitter
Should I run? I have py files at following paths:
\usr\lib\python2.7
\usr\lib\python3\dist-packages
\usr\lib\python3.8
Also this unaccepted answer asks to do:
sudo apt remove python-numpy
I am currently on wsl2 Ubuntu. And am wary, because today only, I (possibly) screwed my another Ubuntu installation, by accidentally deleting all above pythonXYZ
folders. Now I am neither able to remove all traces of python nor able to reinstall python on that machine. It keeps giving me some error (may be I have to ask separate question for that). But how do I fix this WSL Ubuntu?
wget
anddpkg
, but it's somewhat tedious (I've done it)...and seems like a waste of time in a VM environment like WSL. In A VM environment, you throw away a (guest) machine when you are done with it, and spin up a new (guest) machine anytime you need one. – user535733 Mar 05 '21 at 19:57pip
to globally install Python packages in/usr
? If so, that was not a good idea; now those files are all mixed up with Ubuntu's Python files. Cleaning that up is tricky. By the way, it's/usr/lib
, not\usr\lib
. – marcelm Mar 06 '21 at 11:26pip
itself doesnt come preinstalled in ubuntu. And when I didsudo apt install pip
and thenpip list
, it showed huge list of packages installed. Usually on windows, when you install python and then dopip list
, you have only two packages insntalled, setuptools and wheel. Also I installed only pipenv withsudo
as suggested by this answer, since with non sudo installation, running pipenv was giving command not found error. So i believe some packages need to be installed withsudo
to put them in/usr
, right? – Rnj Mar 08 '21 at 18:00