如何使用pip卸载可编辑的包(安装-e)

时间:2021-02-09 17:05:06

I have installed some packages with -e

我已经安装了一些-e包。

> pip install -e git+https://github.com/eventray/horus.git@2ce62c802ef5237be1c6b1a91dbf115ec284a619#egg=horus-dev

I with pip freeze I see

我看到了pip冷冻。

> pip freeze
...
-e git+https://github.com/eventray/horus.git@2ce62c802ef5237be1c6b1a91dbf115ec284a619#egg=horus-dev
...

when I try to uninstall the packages I get errors:

当我试图卸载这些包时,我就会出错:

> pip uninstall horus-dev
Cannot uninstall requirement horus-dev, not installed

> pip uninstall horus
Cannot uninstall requirement horus, not installed

How do I uninstall such a package?

如何卸载这样的包?

5 个解决方案

#1


49  

At {virtualenv}/lib/python2.7/site-packages/ (if not using virtualenv then {system_dir}/lib/python2.7/dist-packages/)

在{virtualenv}/lib/python2.7/site-package /(如果不使用virtualenv然后{system_dir}/lib/python2.7/dist-package /)

  • remove the egg file (e.g. distribute-0.6.34-py2.7.egg) if there is any
  • 如果有的话,请把鸡蛋文件(例如:0.6.34-py2.7.egg)去掉。
  • from file easy-install.pth, remove the corresponding line (it should be a path to the source directory or of an egg file).
  • 从file easy-install.pth中删除相应的行(它应该是到源目录或一个egg文件的路径)。

#2


2  

It turns out that my installation was somehow corrupt.

事实证明,我的安装方式有点腐败。

I could find the entry in:

我可以找到入口:

/usr/local/lib/python2.7/site-packages/easy-install.pth

To solve the problem I removed the line in the .pth file by hand!

为了解决这个问题,我手动删除了。pth文件中的行!

import sys; sys.__plen = len(sys.path)
...
/absolute-path-to/horus  # <- I removed this line
...

#3


2  

Install a dev package use cmd:

安装一个开发包使用cmd:

pip install --editable .

Uninstall:

卸载:

rm -r $(find . -name '*.egg-info')

#4


0  

Simply uninstall the package you installed in 'editable' mode:

简单地卸载您安装在“可编辑”模式的包:

pip uninstall yourpackage

#5


0  

This is a bug on debian/ubuntu linux using OS-installed pip (v8.1.1 for me), which is what you'll invoke with sudo pip even if you've upgraded pip (e.g. get-pip.py). See https://github.com/pypa/pip/issues/4438

这是在debian/ubuntu linux上使用os安装的pip (v8.1.1)的一个bug,这是您将用sudo pip调用的,即使您已经升级了pip(例如get-pip.py)。参见https://github.com/pypa/pip/issues/4438

For a discussion on how to clean up see https://askubuntu.com/questions/173323/how-do-i-detect-and-remove-python-packages-installed-via-pip, though the solutions there are of the "remove everything" variety.

关于如何清理的讨论,请参见https://askubuntu.com/questions/173323/how-do- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

...pip packages [go] to /usr/local/lib/python2.7/dist-packages, and apt packages to /usr/lib/python2.7/dist-packages

…pip包[go]到/usr/local/lib/python2.7/dist-package,以及apt包到/usr/lib/python2.7/dist-package。

...a few packages were installed in ~/.local/lib too.

…在~/中安装了几个包。本地/ lib。

For my system all I needed to remove was /usr/local/lib/python2.7/dist-packages/{package_name}.egg-link

对于我的系统,我需要删除的是/usr/local/lib/python2.7/dist-package /{package_name}. egglink。

#1


49  

At {virtualenv}/lib/python2.7/site-packages/ (if not using virtualenv then {system_dir}/lib/python2.7/dist-packages/)

在{virtualenv}/lib/python2.7/site-package /(如果不使用virtualenv然后{system_dir}/lib/python2.7/dist-package /)

  • remove the egg file (e.g. distribute-0.6.34-py2.7.egg) if there is any
  • 如果有的话,请把鸡蛋文件(例如:0.6.34-py2.7.egg)去掉。
  • from file easy-install.pth, remove the corresponding line (it should be a path to the source directory or of an egg file).
  • 从file easy-install.pth中删除相应的行(它应该是到源目录或一个egg文件的路径)。

#2


2  

It turns out that my installation was somehow corrupt.

事实证明,我的安装方式有点腐败。

I could find the entry in:

我可以找到入口:

/usr/local/lib/python2.7/site-packages/easy-install.pth

To solve the problem I removed the line in the .pth file by hand!

为了解决这个问题,我手动删除了。pth文件中的行!

import sys; sys.__plen = len(sys.path)
...
/absolute-path-to/horus  # <- I removed this line
...

#3


2  

Install a dev package use cmd:

安装一个开发包使用cmd:

pip install --editable .

Uninstall:

卸载:

rm -r $(find . -name '*.egg-info')

#4


0  

Simply uninstall the package you installed in 'editable' mode:

简单地卸载您安装在“可编辑”模式的包:

pip uninstall yourpackage

#5


0  

This is a bug on debian/ubuntu linux using OS-installed pip (v8.1.1 for me), which is what you'll invoke with sudo pip even if you've upgraded pip (e.g. get-pip.py). See https://github.com/pypa/pip/issues/4438

这是在debian/ubuntu linux上使用os安装的pip (v8.1.1)的一个bug,这是您将用sudo pip调用的,即使您已经升级了pip(例如get-pip.py)。参见https://github.com/pypa/pip/issues/4438

For a discussion on how to clean up see https://askubuntu.com/questions/173323/how-do-i-detect-and-remove-python-packages-installed-via-pip, though the solutions there are of the "remove everything" variety.

关于如何清理的讨论,请参见https://askubuntu.com/questions/173323/how-do- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

...pip packages [go] to /usr/local/lib/python2.7/dist-packages, and apt packages to /usr/lib/python2.7/dist-packages

…pip包[go]到/usr/local/lib/python2.7/dist-package,以及apt包到/usr/lib/python2.7/dist-package。

...a few packages were installed in ~/.local/lib too.

…在~/中安装了几个包。本地/ lib。

For my system all I needed to remove was /usr/local/lib/python2.7/dist-packages/{package_name}.egg-link

对于我的系统,我需要删除的是/usr/local/lib/python2.7/dist-package /{package_name}. egglink。