- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我试图通过引用这个网站来了解它的用途以及为什么我们应该使用它:
https://python-packaging.readthedocs.io/en/latest/non-code-files.html
但是我还是没能理解。谁能给我展示更多示例或使用方法。
最佳答案
您指向的文档已过时且相当简洁。最好读一下:https://setuptools.readthedocs.io/en/latest/setuptools.html#including-data-files
The
package_data
argument is a dictionary that maps from package names to lists of glob patterns.
示例:
from setuptools import setup
setup(
...
package_data={
# If any package contains *.txt or *.rst files, include them:
'': ['*.txt', '*.rst'],
# And include any *.msg files found in the 'hello' package, too:
'hello': ['*.msg'],
}
)
关于python - setuptools中的package_data有什么用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58411430/
背景 我正在开发一个目录结构大致如下的 python 包: mossutils/ setup.py mossutils/ __init__.py init.py dat
我正在使用 distutils 创建 Python (2) 包安装程序。在我的包中有几个二进制可执行文件,它们从我的 Python 代码中调用。我在我的 setup.py 文件中将它们列为 packa
在 setup.py 中,我这样指定 package_data: packages=['hermes'], package_dir={'hermes': 'hermes'}, package_data
在 Ubuntu 16.04 和 Windows 7(pip 18.1、python 2.7.15)上,我遇到了一个问题,我的包数据进入了 tar.gz 文件,但它们当我使用 pip 安装时,不会安装
我相信这个问题是asked before但我还是有 pip 卡住了。我正在尝试安装一个 Python 包,其中包含一些带有子目录的数据文件。这是我的设置: setup.py src/ mypk
当创建console_scripts作为entry_points时,如何访问包中的数据文件(package_data)? setup( # other stuff entry_poin
如何在没有 MANIFEST.in 文件的情况下为 sdist 包含 package_data? 我的 setup.py 看起来像这样: import setuptools setuptools.se
我正在尝试创建一个 Python 包,并且我的目录结构如下: mypkg/ ├── __init__.py ├── module1 │ ├── x.py │ ├── y.py │ └──
似乎非python资源包含在python分发包中的4种方式之一: Manifest.in 文件(我不确定何时优先于 package_data 或 data_files) package_data in
我不明白为什么当我运行 pip install ../path_to_my_proj/(从 virtualenv)时,没有任何数据文件被复制到 sitepackage/myproj/文件夹。 pyth
我正在尝试让我自己的 pip 包安装工作,但我在 package_data 中指定的附加数据中的子文件夹方面遇到了问题。一切似乎都很好(所有数据都包含在生成的 .zip 文件中),但是当我运行“pip
我是一名优秀的程序员,十分优秀!