【问题标题】:how to add csv files where installing packages with pip install in python? [duplicate]如何在 python 中使用 pip install 安装软件包的位置添加 csv 文件? [复制]
【发布时间】:2020-08-18 15:22:01
【问题描述】:

我花了很多时间来解决这个问题:

我的 setup.py 如下:

install_requires=install_requires,
python_requires='>=3.6.5',

include_package_data=True,

#### CLI
scripts = scripts,

但是,当 pip install -e 。 ,它不会将 *.csv、*.txt 文件复制到 MYpackages/ 中。 如何添加?

检查了以下资源:

Is it possible to include csv file as part of python package

https://python-packaging.readthedocs.io/en/latest/non-code-files.html

【问题讨论】:

标签: python pip setuptools setup.py


【解决方案1】:

由于上面的链接没有提到,我们需要这个额外的行 在 setup.py 中:

package_data={'': ['data/*.csv']},

并添加 MANIFEST.IN 文件

recursive-include YourPackage/data/*.csv

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-07-27
    • 1970-01-01
    • 2018-06-25
    • 1970-01-01
    • 1970-01-01
    • 2019-07-14
    • 2016-09-23
    • 2019-03-14
    相关资源
    最近更新 更多