Python setuptools package_data-子文件夹上的pip失败 [英] Python setuptools package_data - pip fails on subfolders

查看:220
本文介绍了Python setuptools package_data-子文件夹上的pip失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试安装自己的pip软件包,并且在package_data中指定的其他数据中存在子文件夹的问题.一切似乎都很好(所有数据都包含在生成的.zip文件中),但是当我运行"pip install myapp"时,它说:错误:无法复制'myapp \ web \ styles':不存在或不是常规文件"

I am trying to make my own pip package installation to work and I have troubles with subfolders in additional data specified in package_data. Everything seems to be fine (all data are included in produced .zip file), but when I run "pip install myapp", it says: "error: can't copy 'myapp\web\styles': doesn't exist or not a regular file"

Dirtree:

projectDir
  setup.py
  myapp
    __init__.py
    webapp.py
    web
      index.html
      styles
        style.css

setup.py:

from setuptools import setup
    setup (
        zip_safe = False,
        name = "myapp",
        version = "0.1",
        packages = ["myapp"],
        include_package_data = True,
        package_data = {
            "myapp": ["web/*", "web/styles/*"]
        }
    )

创建软件包的命令:

python setup.py sdist

安装命令:

pip install myapp-0.1.zip

我什至尝试指定MANIFEST.in(没有成功):

I have even try to specify MANIFEST.in (with no success):

include myapp/web/*.*
include myapp/web/styles/*.*

当我在没有package_data的情况下仅指定MANIFEST.时,安装成功,但是site-packages/myapp/web中没有文件,因此没有复制package_data.

When I specify only MANIFEST.in withou package_data, installation success, but there are no files in site-packages/myapp/web so no package_data were copied.

我非常绝望,因为我没有发现任何建议我做错了什么,我花了很长时间使它起作用.

I am quite desperate because I haven't found any suggestion what I am doing wrong and I have spent long time to make it work.

对任何建议表示感谢.

推荐答案

好,所以我有一个解决方案:我只用了MANIFEST.in并从setup.py中删除了package_data,一切正常.我以为我曾经尝试过,但是我错了.

Ok, so I have a solution: I have used only MANIFEST.in and removed package_data from setup.py and everything works fine. I thought I have tried this before, but I was wrong.

这篇关于Python setuptools package_data-子文件夹上的pip失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆