【发布时间】:2018-11-21 15:00:00
【问题描述】:
我有使用一些入口点 point 的包,如下所示:
subscribers = {
entry_point.name: entry_point.load()
for entry_point in pkg_resources.iter_entry_points('point')
}
__all__.extend(list(subscribers.keys()))
我曾经有一个模块定义了DummySubscriber,其中包含此代码
setup.py文件
entry_points={
'point': [
'DummySubscriber = dummy.dummy:DummySubscriber',
…
或类似的。
现在每当我iter_entry_points('point') 我也得到这个插件(或类),尽管包已被删除(源已经消失,Anaconda 安装目录中没有任何内容。我不知道这是怎么回事插件还在。
我已经搜索了整个 anaconda 安装目录,但没有找到。
如何删除它?
【问题讨论】:
-
很可能软件包没有正确卸载(或首先正确安装),元数据仍然漂浮在周围。在您机器上 python 包的安装目标目录中,搜索包含
DummySubscriber = dummy.dummy:DummySubscruber的文件entry_points.txt。在删除之前,请先检查它所在的位置 - 清理完整的元数据目录/存档可能是明智之举。 -
@hoefling 是的,这也是我的假设,但我搜索了
find . -name entry_points.txt返回的所有文件,但里面什么都没有。 -
运行
python -c "import os, pkg_resources; print(os.linesep.join((ep.dist.egg_info for ep in pkg_resources.iter_entry_points('point') if ep.name == 'DummySubscriber')))"时有输出吗? -
是的,实际上,这会返回一个实际上并不存在的文件
/home/share/miniconda3/envs/torch/lib/python3.6/site-packages/dummy_subscriber-0.0.2-py3.6.egg/EGG-INFO,这就是为什么我的find命令没有找到它。 -
egg 文件
/home/share/miniconda3/envs/torch/lib/python3.6/site-packages/dummy_subscriber-0.0.2-py3.6.egg/确实存在,但是我不清楚findingdummy是如何捕捉到它的。删除鸡蛋解决了这个问题。如果你想这样回答,我可以接受。
标签: python-3.x plugins setuptools