Python的easy_install使得安装新包极其方便。然而,据我所知,它没有实现依赖管理器的其他常见特性——列出和删除已安装的包。

找出已安装包的最佳方法是什么,以及删除已安装包的首选方法是什么?如果我手动删除包(例如rm /usr/local/lib/python2.6/dist-packages/my_installed_pkg),是否有任何文件需要更新。鸡蛋或类似的)?


当前回答

官方(?)说明:http://peak.telecommunity.com/DevCenter/EasyInstall#uninstalling-packages

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 -mxN 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.pth 工作,休息PIP安装django==1.3.7

要卸载.egg,您需要rm -rf egg(它可能是一个目录),并从site-packages/easy-install.pth中删除匹配的行

首先你必须运行这个命令:

$ easy_install -m [PACKAGE]

它删除了包的所有依赖项。

然后删除该包的鸡蛋文件:

$ sudo rm -rf /usr/local/lib/python2.X/site-packages/[PACKAGE].egg

在尝试卸载随时间安装的许多随机Python包时遇到了这个问题。

利用这篇文章中的信息,我得出了以下结论:

cat package_list | xargs -n1 sudo pip uninstall -y

从virtualenv中的pip冻结中清理package_list (awk)。

删除几乎所有Python包:

yolk -l | cut -f 1 -d " " | grep -v "setuptools|pip|ETC.." | xargs -n1 pip uninstall -y

我在MacOS X Leopard 10.6上也遇到了同样的问题。

解决方案是确保你正在调用MacPorts Python:

sudo port install python26
sudo port install python_select
sudo python_select python26
sudo port install py26-mysql

希望这能有所帮助。