简体   繁体   English

python distutils不包含data_files

[英]python distutils does not include data_files

I am new to distutils.. I am trying to include few data files along with the package.. here is my code.. 我是distutils的新手..我正在尝试包含一些数据文件以及包..这是我的代码..

from distutils.core import setup

setup(name='Scrapper',
      version='1.0',
      description='Scrapper',      
      packages=['app', 'db', 'model', 'util'],
      data_files=[('app', ['app/scrapper.db'])]      
     )

The zip file created after executing python setup.py sdist does not include the scrapper.db file. 执行python setup.py sdist后创建的zip文件不包含scrapper.db文件。 I have scrapper.db file in the app directory.. 我在app目录中有scrapper.db文件..

thanks for the help. 谢谢您的帮助。

You probably need to add a MANIFEST.in file containing "include app/scrapper.db" . 您可能需要添加包含"include app/scrapper.db"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. 这是distutils中的一个错误,它使得必要: data_filespackage_data任何内容都应该自动包含在生成的MANIFEST But in Python 2.6 and earlier, it is not, so you have to include it in MANIFEST.in . 但是在Python 2.6及更早版本中,它不是,所以你必须将它包含在MANIFEST.in

The bug is fixed in Python 2.7. 该错误在Python 2.7中得到修复。

Try removing MANIFEST, that way distutils will be forced to regenerate it. 尝试删除MANIFEST,这样distutils将被迫重新生成它。

Note: I've been using python 3.x, so I don't know if this works with 2.x or not. 注意:我一直在使用python 3.x,所以我不知道这是否适用于2.x。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM