栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

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

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

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模块将其复制。[…]



转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/668237.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号