How to delete an installed module in Python?

PythonServer Side ProgrammingProgramming

You can uninstall most installed Python packages using pip. For more info on pip uninstall, head over to: For example, if you have numpy package installed and want to uninstall it, then enter the following:

$ pip uninstall numpy

However there are some exceptions. These packages cant be removed easily using pip:

1. Pure distutils packages installed with python install, which leave behind no metadata to determine what files were installed.

2. Script wrappers installed by python develop.

You need to remove all files manually, and also undo any other stuff that installation did manually.

If you don't know the list of all files, you can reinstall it with the --record option, and take a look at the list this produces. To record list of installed files, you can use:

$ python install --record files.txt

Now you'll have a list of all files in the files.txt, which you can then manually remove.

Updated on 01-Oct-2019 06:56:09