gpt4 book ai didi

python - setuptools中的package_data有什么用?

转载 作者:行者123 更新时间:2023-12-01 00:27:56 27 4
gpt4 key购买 nike

我试图通过引用这个网站来了解它的用途以及为什么我们应该使用它:

https://python-packaging.readthedocs.io/en/latest/non-code-files.html

但是我还是没能理解。谁能给我展示更多示例或使用方法。

最佳答案

您指向的文档已过时且相当简洁。最好读一下:https://setuptools.readthedocs.io/en/latest/setuptools.html#including-data-files

The package_data argument is a dictionary that maps from package names to lists of glob patterns.

示例:

from setuptools import setup
setup(
...
package_data={
# If any package contains *.txt or *.rst files, include them:
'': ['*.txt', '*.rst'],
# And include any *.msg files found in the 'hello' package, too:
'hello': ['*.msg'],
}
)

关于python - setuptools中的package_data有什么用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58411430/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com