简体   繁体   English

使用 PIP 在 Flatpak 中安装 Pillow

[英]Using PIP to install Pillow in a Flatpak

I've added a new function to a Python program which works when I run the program on my PC, but it isn't working in my Flatpak.我在 Python 程序中添加了一个新的 function 程序,当我在我的 PC 上运行该程序时它可以工作,但它在我的 Flatpak 中不起作用。 I assumed that it was probably because the Pillow version on my PC (8.3.2) is rather more recent than that in the Flatpak manifest (5.4.1).我认为这可能是因为我 PC 上的 Pillow 版本(8.3.2)比 Flatpak 清单(5.4.1)中的版本更新。 The problem is that I can't get the Flatpak to build with the later version.问题是我无法使用更高版本构建 Flatpak。 I'm no expert on PIP or Flatpaks.我不是 PIP 或 Flatpaks 方面的专家。 Relevant part of manifest:清单的相关部分:

  - name: python3-pillow
    buildsystem: simple
    build-commands:
      - pip3 install --no-index --find-links="file://${PWD}" --prefix=${FLATPAK_DEST} Pillow
    sources:
      - type: file
        #    url: https://files.pythonhosted.org/packages/3c/7e/443be24431324bd34d22dd9d11cc845d995bcd3b500676bcf23142756975/Pillow-5.4.1.tar.gz
        #    sha256: 5233664eadfa342c639b9b9977190d64ad7aca4edc51a966394d7e08e7f38a9f
        # try later version of pillow
        url: https://github.com/python-pillow/Pillow/archive/refs/tags/8.3.2.tar.gz
        sha256: 8252b6b514aed2743abb5b7259b3253d6c4bf86902b9c5acd33fe79d24ec7b2f

Relevant part of Flatpak building output: Flatpak建设output的相关部分:

=======================================================================
Building module python3-pillow in /home/me/.flatpak-builder/build/python3-pillow-8
========================================================================
Running: pip3 install --no-index --find-links="file://${PWD}" --prefix=${FLATPAK_DEST} Pillow
Looking in links: file:///run/build/python3-pillow
ERROR: Could not find a version that satisfies the requirement Pillow (from versions: none)
ERROR: No matching distribution found for Pillow
Error: module python3-pillow: Child process exited with code 1
END ================================================================================================

It looks as though it fails to download the tarball, but if I put the address into a browser, it downloads.看起来好像无法下载 tarball,但如果我将地址放入浏览器,它就会下载。

The problem is that pip is searching for a file in $PWD (/run/build/python3-pillow/) and it can't find a file that matches your system and your python version.问题是 pip 正在$PWD (/run/build/python3-pillow/) 中搜索文件,但找不到与您的系统和 python 版本匹配的文件。 So eather you didn't download any thing due to an error in the manifest file or you are downlaoding the wrong file.因此,由于清单文件中的错误,您没有下载任何东西,或者您正在下载错误的文件。

I can't find any errors in the manifest, at least on the part that you posted.我在清单中找不到任何错误,至少在您发布的部分上。

Have you tried to use a wheel file rather then a tar.gz archive?您是否尝试过使用 wheel 文件而不是tar.gz存档?

A list of them for the latest pillow version are here .最新pillow版本的列表在这里 I don't know what runtime you are using for flatpak but the (org.freedesktop.Sdk-21.08) runtime has python v3.9.9 and i can assume that your app is for x86_64 so i think that Pillow-9.2.0-cp39-cp39-manylinux_2_28_x86_64.whl should work with you.我不知道您为 flatpak 使用什么运行时,但 (org.freedesktop.Sdk-21.08) 运行时有python v3.9.9 ,我可以假设您的应用程序适用于x86_64 ,所以我认为Pillow-9.2.0-cp39 -cp39-manylinux_2_28_x86_64.whl应该适合你。

Answer here:Python Forum在这里回答:Python 论坛

Blah, blah.呸呸呸。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM