pkg_resources: get own distribution?
问题 I want to find the distribution of a file. The file should discovery its own distribution. I tried this, but this does not work: import os import pkg_resources for dist in pkg_resources.find_distributions(os.path.dirname(__file__)): print dist The file with the of the above was installed using pip install -e ... . I could not find a solution in the docs: https://pythonhosted.org/setuptools/pkg_resources.html#distribution-objects The solution should not contain the string of the package. It