find_packages doesn't find my Python file

天大地大妈咪最大 提交于 2019-12-10 13:48:44

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!