删除python安装包的方法

这篇文章主要介绍了删除python安装包的方法,具有一定借鉴价值,需要的朋友可以参考下。希望大家阅读完这篇文章后大有收获。下面让小编带着大家一起了解一下。

怎么删除python安装包

python 安装模块,一般pip 或者 python setup.py install..反之 卸载的话,一般是直接删除module 文件夹,或者通过record记录去自动删除,具体如下。

一、源码包安装的删除

我们使用 python setup.py install 来安装python包,但是如何卸载呢?

只能手动删除安装的文件,可以使用如下命令:

linux下的删除:

# python setup.py install --record files.txt 记录安装后文件的路径

# cat files.txt | xargs rm -rf 删除这些文件

windows下的删除:

C:\selenium-2.43.0>python setup.py install --record ./record.txt

C:\selenium-2.43.0>FOR /F %f in (record.txt) DO del %f

二、easy_install 安装的删除

以下从豆瓣上看到方法

If you have replaced a package with another version, then you can just delete the package(s) you don't need by deleting the PackageName-versioninfo.egg file or directory (found in the installation directory).

If you want to delete the currently installed version of a package (or all versions of a package), you should first run:

easy_install -m PackageName

This will ensure that Python doesn't continue to search for a package you're planning to remove. After you've done this, you can safely delete the .egg files or directories, along with any scripts you wish to remove.

就是运行:easy_install -m PackageName

完了,你在C:\Python25\Lib\site-packages\下,删除模块文件夹就好了。

感谢你能够认真阅读完这篇文章,希望小编分享删除python安装包的方法内容对大家有帮助,同时也希望大家多多支持亿速云,关注行业资讯频道,遇到问题就找亿速云,详细的解决方法等着你来学习!