【发布时间】:2021-12-22 13:32:03
【问题描述】:
如何将不是用 python 编写的文件包含到包装中? 或者让它更具体: 假设我有如下的包结构,如何包含templates目录下的所有文件?
- projectname
- __init__.py
- classfile.py
- templates
- file1.prototxt
- file2.caffemodel
我有以下setup.py
from distutils.core import setup
setup(
name = 'projectname',
packages = ['projectname'],
version = '0.1',
license='MIT',
description = 'my description',
author = 'FULL NAME',
author_email = 'example@gmail.com',
url = 'https://github.com/repo',
download_url = 'https://github.com/repo/.../v_01.tar.gz',
keywords = ['keywords'],
install_requires=[
'opencv-python',
'numpy'
],
classifiers=[
'Development Status :: 3 - Alpha',
'Intended Audience :: Developers',
'Topic :: Software Development :: Build Tools',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 3',
],
)
当我在 stackoverflow 上某处阅读时,我尝试将以下内容添加到 setup.py 文件中,但没有任何区别。
package_data = {
'templates': ['*'],
}
【问题讨论】:
标签: python pip setuptools distutils python-packaging