Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deleting python modules?

Tags:

Can you delete python modules? I've installed one that I would like to remove, and can't seem to figure out how.

Thanks

like image 828
Matthew Avatar asked Mar 23 '10 16:03

Matthew


People also ask

Does uninstalling Python remove all packages Windows?

@patelshahrukh uninstalling python DOES NOT remove pip packages. please AVOID doing that, since it both most likely WON'T WORK the way you think it will, and, depending on how you install python again, can leave your machine in an unstable state that's more work to fix.

Can you uninstall packages with pip?

pip is able to uninstall most installed packages. Known exceptions are: Pure distutils packages installed with python setup.py install , which leave behind no metadata to determine what files were installed. Script wrappers installed by python setup.py develop .


2 Answers

To find where the module is, just do a:

 $ python  >> import module  >> print module.__file__  '/some/directory' 

or if it is a package:

 >> import package  >> print package.__path__ 

and delete it.

like image 156
rlotun Avatar answered Oct 15 '22 15:10

rlotun


If you are using python under windows, the following command is what you need

pip uninstall module 

In some cases, you may have installed different versions of the module. For example, after I had the lxml3.4.4 installed via pip, I also installed lxml3.5.0 using its pre-built binary, and thus, the command listed above only remove the first one. So I need to run it twices

pip uninstall lxml pip uninstall lxml 

And it got completed uninstalled. See whether it helps.

like image 38
API Avatar answered Oct 15 '22 14:10

API