Python

How to remove installed packages in Python

April 5, 2022

How to remove installed packages in Python

In this article you will learn how to remove installed packages in Python – using resources of the language itself and also using the pip command

remove installed packages in Python thumb

Hey you all programmers, let’s learn how to remove packages installed in our Python applications!

Plus: Without using package manager, you will need to remove package files manually

To know which files belong to each module is simple, you can use the following command to have the files listed:

python setup.py install --record files.txt

This command will generate a file called files.txt, where you will be able to find the directories of the packages already installed

Then just remove them and that’s it!

If you’re on Linux, it’s even easier, use the following command to remove them all:

cat files.txt | xargs rm -rf

And if you use a package manager like pip, it’s even easier to remove these packages

To check all installed packages you can use the following command:

pip freeze

And to uninstall a specific package, try this one out:

pip uninstall package

Cool huh?

Now just identify which approach your application will benefit from the most or that it is possible to perform

Conclusion

In this article we learned how to remove installed packages in Python

Firstly a manual method, checking out which packages were installed in the application

And then an alternative running the pip command, which is a package manager for Python

Do you want to learn more about Python? Click here!

Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x