如何在setuptools/distribute中包含软件包数据? [英] How to include package data with setuptools/distribute?

查看:72
本文介绍了如何在setuptools/distribute中包含软件包数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用setuptools/distribute时,我无法让安装程序插入任何 package_data 文件.我读过的所有内容都表明,以下是正确的方法.有人可以请教吗?

When using setuptools/distribute, I can not get the installer to pull in any package_data files. Everything I've read says that the following is the correct way to do it. Can someone please advise?

setup(
   name='myapp',
   packages=find_packages(),
   package_data={
      'myapp': ['data/*.txt'],
   },
   include_package_data=True,
   zip_safe=False,
   install_requires=['distribute'],
)

其中myapp/data/是数据文件的位置.

where myapp/data/ is the location of the data files.

推荐答案

我意识到这是一个古老的问题,但是对于通过Google在这里找到自己的方式的人来说:package_data是一个低调的

I realize that this is an old question, but for people finding their way here via Google: package_data is a low-down, dirty lie. It is only used when building binary packages (python setup.py bdist ...) but not when building source packages (python setup.py sdist ...). This is, of course, ridiculous -- one would expect that building a source distribution would result in a collection of files that could be sent to someone else to built the binary distribution.

在任何情况下,都可以使用 MANIFEST.in 都是,用于二进制文件和源代码分发.

In any case, using MANIFEST.in will work both for binary and for source distributions.

这篇关于如何在setuptools/distribute中包含软件包数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆