在Python中,如何进行“运行”?目录中的子包?
我希望结构看起来像:
Overall_Package/
__init__.py
run_package/{
__init__.py
run__subpackage1.py
run_subpackage2.py
run_subpackage3.py
...
}
code package/ {
Basic_code_package_that_is_used_in_many_if_not_all_the_sub_packages
Sub_package1
subpackage2
....
}
我不能使用相对导入,因为它们位于同一个整体包中,但我需要一个与此类似的结构以便于下载。
I would prefer to have the structure to look like:
Overall_Package/
__init__.py
run_package/{
__init__.py
run__subpackage1.py
run_subpackage2.py
run_subpackage3.py
...
}
code package/ {
Basic_code_package_that_is_used_in_many_if_not_all_the_sub_packages
Sub_package1
subpackage2
....
}
I cannot use relative imports as they are in the same overall package, but I need a structure similar to this for easy downloading.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不太确定我是否明白你的问题以及你到底想要什么。您是否需要分发它并希望它具有该结构?如果是这样,您始终可以使用 setuptools 或 distutils 并将包及其结构安装到 python 的 site-packages 目录中。
I'm not quite sure I follow your question and what is it exactly you want. Do you need to distribute this and would like it to have that structure? If so you can always use setuptools or distutils and install your package with it's structure to python's site-packages directory.