Python setuptools:如何包括配置文件以分发到 等等

Python setuptools:如何包括配置文件以分发到 等等,第1张

Python setuptools:如何包括配置文件以分发到 /等等

我正在对此问题进行一些研究,我认为答案在setuptools文档中:http ://peak.telecommunity.com/DevCenter/setuptools#non-
package-data-files

接下来,我引用我认为有答案的摘录:

非包装数据文件

The distutils normally install general “data files” to a platform-specific
location (e.g. /usr/share). This feature intended to be used for things like
documentation, example configuration files , and the like. setuptools
does not install these data files in a separate location, however. They are
bundled inside the egg file or directory, alongside the Python modules and
packages. The data files can also be accessed using the Resource Management
API […]

注意,顺便说一句,数据文件的这种封装意味着 您实际上不能将数据文件安装到用户计算机上的任意位置
。这是一个功能,而不是错误。您始终可以在自己的发行版中包含一个脚本,该脚本可以自行决定将文档或数据文件提取并复制到用户指定的位置。如果将相关数据文件放在单个目录中,则可以将resource_filename()与目录名一起使用,以获取文件系统目录,然后可以使用shutil模块将其复制。[…]



欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/5673494.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-16
下一篇 2022-12-17

发表评论

登录后才能评论

评论列表(0条)

保存