简体   繁体   中英

Trying to delete all installed files on ubuntu

I want to delete all the packages installed when I ran

sudo apt install python3-pip

which is the only thing I installed so far (alongside numpy). I tried using

pip3 uninstall -y -r <(pip freeze) 

But for every single package in pip3 list I get a statement as such:

Found existing installation attrs 19.3.0

Not uninstalling attrs at /ur/lib/python3/dist-packages, outside environment /usr

Can't uninstall 'attrs'. No files were found to uninstall.

This is on a Windows OS using the Windows Subsystem for linux and Ubuntu 20.04.2.

Can't seem to find a solution online that doesn't display the bold text above:(

You can do an apt-get remove <package_name> OR an apt-get purge <package_name> .

remove will uninstall the binaries and can be executed like so:

sudo apt-get remove python3-pip

purge will uninstall the binaries and remove any related cruft like config files that were created as a part of the installation. You can execute like so:

sudo apt-get purge python3-pip

If you installed libraries specifically via pip3 install and wanted to delete everything you've installed via pip3, you can do:

for x in $(pip3 list | awk '{print $1}' | egrep -v '^(Package|[-]+)'); do echo "${x}"; done

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM