[英]How to make a python package/distribution with files other than .py extension?
I want to make a package/distribution of the project above, but the main module uses icon.png and saves files into the data folder.我想对上面的项目进行打包/分发,但主模块使用 icon.png 并将文件保存到数据文件夹中。 When launching setup.py with the following code
使用以下代码启动 setup.py 时
from distutils.core import setup
setup(name='Project',
version='1.0',
py_modules=['Main'],
)
it makes a tar.gz archive only with main.py.它仅使用 main.py 制作 tar.gz 存档。 How to include other files?
如何包含其他文件?
According to the docs on readthedocs.com you should add a file MANIFEST.in
where you can include the files you wish to pack in your package.根据readthedocs.com上的文档,您应该添加一个文件
MANIFEST.in
,您可以在其中包含您希望打包到 package 中的文件。
include <project_name>/resources/icon.png
Another note from the page:页面上的另一个注释:
In order for these files to be copied at install time to the package's folder inside site-packages, you'll need to supply include_package_data=True to the setup() function.
为了在安装时将这些文件复制到站点包内的包文件夹,您需要将 include_package_data=True 提供给 setup() function。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.