问题描述
使用setuptools时,我无法让安装程序插入任何文件。我读过的所有内容都表明,以下是正确的方法。有人可以建议吗?
When using setuptools, 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
是一个低端版本,。仅在构建 binary 软件包( python setup.py bdist ...
)时使用,而在构建源代码时不使用 软件包( python setup.py sdist ...
)。当然,这是荒谬的-人们希望构建源分发版会导致文件集合,这些文件可以发送给其他人来构建二进制分发版。
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.
在任何情况下,请使用对于二进制文件和源代码分发版都可以使用。
In any case, using MANIFEST.in
will work both for binary and for source distributions.
这篇关于如何在setuptools / distutils中包含软件包数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!