“包数据”文件在哪里?

问题描述 投票:0回答:1

我已经使用 distutils 创建了包,包括包数据。 当我查看包的 tar.gz 时,我看到了预期的文件,但是在包安装后(通过 pip 或“python setup.py install”)没有任何包数据。仅包含 python 脚本。我的

setup.py
是:

# py3.3
#from packaging.core import setup
# py3.2
from distutils.core import setup

setup(
    name = 'mypkg',
    version = '0.7dev',
    author = 'author',
    author_email = 'email',
    packages = [
        'my_pkg',
        'my_pkg/tests',
        'my_pkg/plugins',
    ],
    #scritps=['bin/setup.sh',],
)
python virtualenv packaging pip distutils
1个回答
6
投票

要安装的包数据应作为传递给

package_data={}
函数的
setup()
字典包含在内。每个字典都提供要安装的模块(包)以及用于查找要从中安装/与其一起安装的数据文件的模式列表,例如:

package_data = {
    'exceptional_middleware': [ 'templates/http_responses/*.html' ],
}

此外,您可能不想安装测试(只需从

pkg/tests
列表中删除
packages
)。

© www.soinside.com 2019 - 2024. All rights reserved.