python设置.py问题

2024-06-29 00:00:59 发布

您现在位置:Python中文网/ 问答频道 /正文

所以我有一个类似这样的文件夹结构:

pckA - core
     - io
pckB - core
     - io
     - main

现在我要创建一个设置.py两个包的文件。我目前的做法是:

^{pr2}$

这个设置.py与pckA和pckB位于同一个文件夹中。所以我的问题是:是否有必要添加pckA核心或者setuptools也知道安装这些工具吗?在


Tags: 文件工具pyiocore文件夹核心main
1条回答
网友
1楼 · 发布于 2024-06-29 00:00:59

不,如果您只需要整个包,那么指定它的名称(即pckA)就足够了,无需列出其中的所有模块。distutils将递归地发现它们。在

所以在你的情况下:

packages=['pckA', 'pckB'],

就这样。以下是the docs中的一句话:

The packages option tells the Distutils to process (build, distribute, install, etc.) all pure Python modules found in each package mentioned in the packages list. In order to do this, of course, there has to be a correspondence between package names and directories in the filesystem.


如果您不想要整个包,而希望只包含特定的模块,请使用py_modules选项。在

相关问题 更多 >