问题
I have a directory tree like this:
dir/
A/
__init__.py
something.py
I used find_packages on dir/A and expected it to find something.py. However, it returned an empty list. How do I make find_packages find something.py as a package?
from setuptools import find_packages
packages = find_packages('c:/dir/A')
print(packages)
回答1:
You'd need to make it a package, it's a module right now. You would do this the same way you made the A package: create a directory with the package name, include an __init__.py file (in this case, you would rename something.py to __init__.py under the something directory).
find_packages('c:/dir') would find A, since A is a package under c:/dir.
来源:https://stackoverflow.com/questions/42984118/find-packages-doesnt-find-my-python-file