9

我有一个 Python 应用程序,它通过pkg_resources.iter_entry_points.

当直接从源结帐运行时,这将找到符合要求的任何内容sys.path,包括恰好具有适用于查找的源.egg-info结帐setuptools

然而,当我在任何地方安装软件包时python setup.py install,它突然停止检测枚举中的所有内容sys.path,而只查找安装在它旁边的东西site-packages

  • 为什么pkg_resources.iter_entry_points香草源结帐与已安装应用程序的行为不同?
  • 我怎样才能让它sys.path像在开发中那样遍历所有内容?
4

1 回答 1

1
  1. How to get it to iterate over sys.path?

    pkg_resources.WorkingSet(None).iter_entry_points

  2. Why does it behave differently? Probably because the installed package forces at least the meta data about itself into memory. Looking at the code, my guess would be that your main module has a requires attribute, but that's only an educated guess. Anyway, to force the "installed" behaviour while developing, it should be enough to run python setup.py develop

于 2014-09-16T16:59:32.703 回答