MANIFEST.in,package

编程入门 行业动态 更新时间:2024-10-26 22:24:46
本文介绍了MANIFEST.in,package_data和data_files的说明?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在尝试创建一个Python包,并且具有这样的目录结构:

I am trying to create a Python package, and I have a directory structure like this:

mypkg/ ├── __init__.py ├── module1 │   ├── x.py │   ├── y.py │   └── z.txt └── module2 ├── a.py └── b.py

然后我将所有文件添加到 MANIFEST.in 中,当我检查创建的存档时,它具有所有文件。

Then I added all the files in MANIFEST.in and when I check the created archive, it had all the files.

当我在 dist-packages / mypkg /中执行 python setup.py install 时module1 。我只看到Python文件,没有看到 z.txt 。

When I do python setup.py install in the dist-packages/mypkg/module1. I see only the Python files and not z.txt.

我有 z。 txt 在 MANIFEST.in 和 setup.py 中:

setup ( packages = [ 'mypkg', 'mypkg.module1', 'mypkg.module2', ], package_data = { 'mypkg': ['module1/z.txt'] }, include_package_data = True, ... )

我尝试添加该文件也称为 data_files ,但在 / usr / local 中创建了一个目录。我想将其保存在源代码目录中,因为代码使用了这些数据。

I tried adding the file as data_files as well but that created a directory in /usr/local. I want to keep it inside the source code directory as the code uses that data.

我阅读了下面列出的信息,但对于正确的方法我一直感到困惑在 setup.py安装之后,将 z.txt 保留在正确的位置。

I have read the posts listed below but I keep getting confused about what is the right way to keep z.txt in the right location after setup.py install.

  • MANIFEST.in在 python setup.py install中被忽略-没有安装数据文件?
  • 使用setup.py
  • blog.codekills/2011/07/15/lies, -more-lies-and-python-packaging-documentation-on--package_data- /
  • MANIFEST.in ignored on "python setup.py install" - no data files installed?
  • Installing data files into site-packages with setup.py
  • blog.codekills/2011/07/15/lies,-more-lies-and-python-packaging-documentation-on--package_data-/
推荐答案

更新:当我开始使用setuptools而不是distutils.core时,此问题已得到解决。我认为在setuptools正常工作而不修改代码的情况下,distutils与清单文件不符是一个问题。我建议将来使用setuptools。使用此处的链接:设置工具-开发人员指南

Update: It got fixed when I started using setuptools instead of distutils.core. I think it was some problem with distutils not agreeing with manifest while setuptools worked without any changes in the code. I recommend using setuptools in the future. Using the link here : setup tools- developers guide

更多推荐

MANIFEST.in,package

本文发布于:2023-07-05 15:53:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1039122.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:MANIFEST   package

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!