我有一个结构如下的python包:
mypackage
├───build
├───dist
├───mypackage-------> file1.py, file2.py
│ └───templates-->temp.html
└───test
└───MANIFEST.in
└───setup.py
我想要做的是包括模板文件夹。
这是我的setup.py的相关部分
setup(
packages=find_packages(),
include_package_data=True,
package_data = {'mypackages': ['templates/*.html']},
这是我的清单
include mypackage/templates
recursive-include mypackage/ *.html
要生成压缩文件,我使用以下命令:
python setup.py sdist
为什么没有包含template文件夹的任何想法?
最佳答案
您必须使用MANIFEST.in来指定要包含的文件。
重复:
How to include package data with setuptools/distribute?
2 techniques for including files in a Python distribution: which is better?
关于python - python在分发包中包含一个文件夹,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/26925975/