python distutils不包含data_files [英] python distutils does not include data_files
问题描述
我是distutils的新手。.我试图在软件包中包括一些数据文件。.这是我的代码。
I am new to distutils.. I am trying to include few data files along with the package.. here is my code..
from distutils.core import setup
setup(name='Scrapper',
version='1.0',
description='Scrapper',
packages=['app', 'db', 'model', 'util'],
data_files=[('app', ['app/scrapper.db'])]
)
执行 python setup.py sdist
不包括scrapper.db文件。我在app目录中有scrapper.db文件。
The zip file created after executing python setup.py sdist
does not include the scrapper.db file. I have scrapper.db file in the app directory..
感谢帮助。
推荐答案
您可能需要添加一个 MANIFEST.in
文件,其中包含 include app / scrapper.db
。
You probably need to add a MANIFEST.in
file containing "include app/scrapper.db"
.
这是distutils中的一个错误,使得有必要: data_files
或 package_data
应该自动包含在生成的 MANIFEST
中。但是在Python 2.6和更早版本中则不是,因此您必须将其包含在 MANIFEST.in
中。
It's a bug in distutils that makes this necessary: anything in data_files
or package_data
should be included in the generated MANIFEST
automatically. But in Python 2.6 and earlier, it is not, so you have to include it in MANIFEST.in
.
该错误已在Python 2.7中修复。
The bug is fixed in Python 2.7.
这篇关于python distutils不包含data_files的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!