Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python Pip: Is it safe to delete ~/.local/bin in order to delete all user packages installed by pip?

Tags:

python

pip

I installed a few user packages with pip by using

pip3 install --user <package_name>

I did this on a machine running Ubuntu 17.10.

I would like to start afresh. Is it safe to delete ~/.local/bin in order to do so or is there some other, more elegant solution? In particular, I'm worrying about messing with the Python packages, which my system requires to function properly.

like image 452
mamr Avatar asked Oct 23 '25 20:10

mamr


1 Answers

The Free Desktop Specification notes that ~/.local/bin is a general place for user binaries, so I don't think its safe to assume that deleting that wont affect anything else.

The best method would be to use pip3 uninstall --user <package> to remove specific packages. you can list installed packages with pip3 list --user

Edit: A one-liner to delete all pip3 installed packages, using pip3's uninstall method and jq:

pip3 list --user --format=json | jq '.[].name' | xargs -I{} pip3 uninstall --user {}

Be careful though, as it will delete everything user installed, whether you use it or not!

like image 119
ThePengwin Avatar answered Oct 26 '25 11:10

ThePengwin