Python's easy_install
makes installing new packages extremely convenient. However, as far as I can tell, it doesn't implement the other common features of a dependency manager - listing and removing installed packages.
Python的easy_install使安装新包非常方便。但是,据我所知,它没有实现依赖项管理器的其他常见功能——列出并删除已安装的包。
What is the best way of finding out what's installed, and what is the preferred way of removing installed packages? Are there any files that need to be updated if I remove packages manually (e.g. by rm /usr/local/lib/python2.6/dist-packages/my_installed_pkg.egg
or similar)?
找出安装的最好的方法是什么,以及移除已安装包的首选方法是什么?如果我手动删除包,是否有需要更新的文件(例如:rm /usr/local/lib/python2.6/dist-package /my_installed_pkg)。鸡蛋或类似的)?
13 个解决方案
#1
590
pip, an alternative to setuptools/easy_install, provides an "uninstall" command.
pip是setuptools/easy_install的另一种选择,它提供了一个“卸载”命令。
Install pip according to the installation instructions:
根据安装说明安装pip:
$ wget https://bootstrap.pypa.io/get-pip.py
$ python get-pip.py
Then you can use pip uninstall
to remove packages installed with easy_install
然后,您可以使用pip卸载来删除安装了easy_install的包。
#2
182
To uninstall an .egg
you need to rm -rf
the egg (it might be a directory) and remove the matching line from site-packages/easy-install.pth
要卸载一个.egg,你需要rm -rf这个鸡蛋(它可能是一个目录),并从site-package /easy-install.pth中删除匹配的行。
#3
152
First you have to run this command:
首先,您必须运行以下命令:
$ easy_install -m [PACKAGE]
It removes all dependencies of the package.
它删除了包的所有依赖项。
Then remove egg file of that package:
然后删除该包的鸡蛋文件:
$ sudo rm -rf /usr/local/lib/python2.X/site-packages/[PACKAGE].egg
#4
54
All the info is in the other answers, but none summarizes both your requests or seem to make things needlessly complex:
所有的信息都在其他的答案中,但是没有一个可以总结你的请求或者看起来让事情变得不必要的复杂:
-
For your removal needs use:
为您的移除需要使用:
pip uninstall <package>
(install using
easy_install pip
)(使用easy_install pip安装)
-
For your 'list installed packages' needs either use:
您的“已安装软件包”需要使用:
pip freeze
Or:
或者:
yolk -l
which can output more package details.
可以输出更多的包细节。
(Install via
easy_install yolk
orpip install yolk
)(通过easy_install蛋黄或pip安装蛋黄安装)
#5
28
There are several sources on the net suggesting a hack by reinstalling the package with the -m option and then just removing the .egg file in lib/ and the binaries in bin/. Also, discussion about this setuptools issue can be found on the python bug tracker as setuptools issue 21.
net中有几个消息来源,建议使用-m选项重新安装包,然后删除lib中的.egg文件和bin/的二进制文件。另外,关于这个setuptools问题的讨论可以在python bug跟踪器上找到,如setuptools第21期。
Edit: Added the link to the python bugtracker.
编辑:添加到python bugtracker的链接。
#6
25
If the problem is a serious-enough annoyance to you, you might consider virtualenv. It allows you to create an environment that encapsulates python libraries. You install packages there rather than in the global site-packages directory. Any scripts you run in that environment have access to those packages (and optionally, your global ones as well). I use this a lot when evaluating packages that I am not sure I want/need to install globally. If you decide you don't need the package, it's easy enough to just blow that virtual environment away. It's pretty easy to use. Make a new env:
如果这个问题对您来说是一个严重的烦恼,您可能会考虑virtualenv。它允许您创建封装python库的环境。您在那里安装软件包,而不是在全局站点包目录中安装。您在该环境中运行的任何脚本都可以访问这些包(也可以选择您的全局包)。在评估包时,我经常使用它,我不确定是否需要在全球安装。如果您决定不需要这个包,那么只需将虚拟环境吹走就足够了。很容易使用。做一个新的env:
$>virtualenv /path/to/your/new/ENV
virtual_envt installs setuptools for you in the new environment, so you can do:
virtual_envt在新环境中为您安装setuptools,因此您可以这样做:
$>ENV/bin/easy_install
You can even create your own boostrap scripts that setup your new environment. So, with one command, you can create a new virtual env with, say, python 2.6, psycopg2 and django installed by default (you can can install an env-specific version of python if you want).
您甚至可以创建自己的boostrap脚本,来设置您的新环境。因此,使用一个命令,您可以创建一个新的虚拟环境,比如python 2.6、psycopg2和django(如果您愿意的话,您可以安装一个env特定的python版本)。
#7
17
Official(?) instructions: http://peak.telecommunity.com/DevCenter/EasyInstall#uninstalling-packages
官方(?)产品说明:http://peak.telecommunity.com/DevCenter/EasyInstall卸载程序包
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).
如果您已经用另一个版本替换了一个包,那么您可以删除您不需要的包,删除packag- versioninfo。egg文件或目录(在安装目录中找到)。
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.
这将确保Python不会继续搜索您打算删除的包。在完成此操作之后,您可以安全地删除.egg文件或目录,以及您希望删除的任何脚本。
#8
15
try
试一试
$ easy_install -m [PACKAGE]
then
然后
$ rm -rf .../python2.X/site-packages/[PACKAGE].egg
#9
7
To list installed Python packages, you can use yolk -l
. You'll need to use easy_install yolk
first though.
要列出已安装的Python包,可以使用蛋黄-l。不过,首先需要使用easy_install蛋黄。
#10
6
Came across this question, while trying to uninstall the many random Python packages installed over time.
遇到这个问题时,试图卸载安装在时间上的许多随机Python包。
Using information from this thread, this is what I came up with:
利用这个线程的信息,这就是我想到的:
cat package_list | xargs -n1 sudo pip uninstall -y
The package_list
is cleaned up (awk) from a pip freeze
in a virtualenv.
在virtualenv中,从pip冻结中清除package_list (awk)。
To remove almost all Python packages:
删除几乎所有Python包:
yolk -l | cut -f 1 -d " " | grep -v "setuptools|pip|ETC.." | xargs -n1 pip uninstall -y
#11
3
I ran into the same problem on my MacOS X Leopard 10.6.blah.
我在MacOS X Leopard上遇到了同样的问题。
Solution is to make sure you're calling the MacPorts Python:
解决方案是确保调用MacPorts Python:
sudo port install python26
sudo port install python_select
sudo python_select python26
sudo port install py26-mysql
Hope this helps.
希望这个有帮助。
#12
2
For me only deleting this file : easy-install.pth worked, rest pip install django==1.3.7
我只删除了这个文件:easy-install.pth工作,rest pip安装django==1.3.7。
#13
1
This worked for me. It's similar to previous answers but the path to the packages is different.
这为我工作。它类似于前面的答案,但是包的路径是不同的。
- sudo easy_install -m
- sudo easy_install - m
- sudo rm -rf /Library/Python/2.7/site-packages/.egg
- sudo rm射频/图书馆/ Python / 2.7 /网站/ .egg
Plaform: MacOS High Sierra version 10.13.3
Plaform: MacOS High Sierra version 10.13.3。
#1
590
pip, an alternative to setuptools/easy_install, provides an "uninstall" command.
pip是setuptools/easy_install的另一种选择,它提供了一个“卸载”命令。
Install pip according to the installation instructions:
根据安装说明安装pip:
$ wget https://bootstrap.pypa.io/get-pip.py
$ python get-pip.py
Then you can use pip uninstall
to remove packages installed with easy_install
然后,您可以使用pip卸载来删除安装了easy_install的包。
#2
182
To uninstall an .egg
you need to rm -rf
the egg (it might be a directory) and remove the matching line from site-packages/easy-install.pth
要卸载一个.egg,你需要rm -rf这个鸡蛋(它可能是一个目录),并从site-package /easy-install.pth中删除匹配的行。
#3
152
First you have to run this command:
首先,您必须运行以下命令:
$ easy_install -m [PACKAGE]
It removes all dependencies of the package.
它删除了包的所有依赖项。
Then remove egg file of that package:
然后删除该包的鸡蛋文件:
$ sudo rm -rf /usr/local/lib/python2.X/site-packages/[PACKAGE].egg
#4
54
All the info is in the other answers, but none summarizes both your requests or seem to make things needlessly complex:
所有的信息都在其他的答案中,但是没有一个可以总结你的请求或者看起来让事情变得不必要的复杂:
-
For your removal needs use:
为您的移除需要使用:
pip uninstall <package>
(install using
easy_install pip
)(使用easy_install pip安装)
-
For your 'list installed packages' needs either use:
您的“已安装软件包”需要使用:
pip freeze
Or:
或者:
yolk -l
which can output more package details.
可以输出更多的包细节。
(Install via
easy_install yolk
orpip install yolk
)(通过easy_install蛋黄或pip安装蛋黄安装)
#5
28
There are several sources on the net suggesting a hack by reinstalling the package with the -m option and then just removing the .egg file in lib/ and the binaries in bin/. Also, discussion about this setuptools issue can be found on the python bug tracker as setuptools issue 21.
net中有几个消息来源,建议使用-m选项重新安装包,然后删除lib中的.egg文件和bin/的二进制文件。另外,关于这个setuptools问题的讨论可以在python bug跟踪器上找到,如setuptools第21期。
Edit: Added the link to the python bugtracker.
编辑:添加到python bugtracker的链接。
#6
25
If the problem is a serious-enough annoyance to you, you might consider virtualenv. It allows you to create an environment that encapsulates python libraries. You install packages there rather than in the global site-packages directory. Any scripts you run in that environment have access to those packages (and optionally, your global ones as well). I use this a lot when evaluating packages that I am not sure I want/need to install globally. If you decide you don't need the package, it's easy enough to just blow that virtual environment away. It's pretty easy to use. Make a new env:
如果这个问题对您来说是一个严重的烦恼,您可能会考虑virtualenv。它允许您创建封装python库的环境。您在那里安装软件包,而不是在全局站点包目录中安装。您在该环境中运行的任何脚本都可以访问这些包(也可以选择您的全局包)。在评估包时,我经常使用它,我不确定是否需要在全球安装。如果您决定不需要这个包,那么只需将虚拟环境吹走就足够了。很容易使用。做一个新的env:
$>virtualenv /path/to/your/new/ENV
virtual_envt installs setuptools for you in the new environment, so you can do:
virtual_envt在新环境中为您安装setuptools,因此您可以这样做:
$>ENV/bin/easy_install
You can even create your own boostrap scripts that setup your new environment. So, with one command, you can create a new virtual env with, say, python 2.6, psycopg2 and django installed by default (you can can install an env-specific version of python if you want).
您甚至可以创建自己的boostrap脚本,来设置您的新环境。因此,使用一个命令,您可以创建一个新的虚拟环境,比如python 2.6、psycopg2和django(如果您愿意的话,您可以安装一个env特定的python版本)。
#7
17
Official(?) instructions: http://peak.telecommunity.com/DevCenter/EasyInstall#uninstalling-packages
官方(?)产品说明:http://peak.telecommunity.com/DevCenter/EasyInstall卸载程序包
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).
如果您已经用另一个版本替换了一个包,那么您可以删除您不需要的包,删除packag- versioninfo。egg文件或目录(在安装目录中找到)。
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.
这将确保Python不会继续搜索您打算删除的包。在完成此操作之后,您可以安全地删除.egg文件或目录,以及您希望删除的任何脚本。
#8
15
try
试一试
$ easy_install -m [PACKAGE]
then
然后
$ rm -rf .../python2.X/site-packages/[PACKAGE].egg
#9
7
To list installed Python packages, you can use yolk -l
. You'll need to use easy_install yolk
first though.
要列出已安装的Python包,可以使用蛋黄-l。不过,首先需要使用easy_install蛋黄。
#10
6
Came across this question, while trying to uninstall the many random Python packages installed over time.
遇到这个问题时,试图卸载安装在时间上的许多随机Python包。
Using information from this thread, this is what I came up with:
利用这个线程的信息,这就是我想到的:
cat package_list | xargs -n1 sudo pip uninstall -y
The package_list
is cleaned up (awk) from a pip freeze
in a virtualenv.
在virtualenv中,从pip冻结中清除package_list (awk)。
To remove almost all Python packages:
删除几乎所有Python包:
yolk -l | cut -f 1 -d " " | grep -v "setuptools|pip|ETC.." | xargs -n1 pip uninstall -y
#11
3
I ran into the same problem on my MacOS X Leopard 10.6.blah.
我在MacOS X Leopard上遇到了同样的问题。
Solution is to make sure you're calling the MacPorts Python:
解决方案是确保调用MacPorts Python:
sudo port install python26
sudo port install python_select
sudo python_select python26
sudo port install py26-mysql
Hope this helps.
希望这个有帮助。
#12
2
For me only deleting this file : easy-install.pth worked, rest pip install django==1.3.7
我只删除了这个文件:easy-install.pth工作,rest pip安装django==1.3.7。
#13
1
This worked for me. It's similar to previous answers but the path to the packages is different.
这为我工作。它类似于前面的答案,但是包的路径是不同的。
- sudo easy_install -m
- sudo easy_install - m
- sudo rm -rf /Library/Python/2.7/site-packages/.egg
- sudo rm射频/图书馆/ Python / 2.7 /网站/ .egg
Plaform: MacOS High Sierra version 10.13.3
Plaform: MacOS High Sierra version 10.13.3。