Python package with data files

2019-06-10 02:33发布

问题:

A Python package should contain some data files alongside with Python sources.

  1. How to make setuptools or distutils to install the data files?

  2. How can my Python code know which directories my data files are installed in?

回答1:

Following will answer your Q#1:

There is a concept of data_file and package_data.

Package_data is used to include documentation and data_files is used to include configuration file, messages and data file.