<bdo id='mZVIp'></bdo><ul id='mZVIp'></ul>

    <legend id='mZVIp'><style id='mZVIp'><dir id='mZVIp'><q id='mZVIp'></q></dir></style></legend>
      <i id='mZVIp'><tr id='mZVIp'><dt id='mZVIp'><q id='mZVIp'><span id='mZVIp'><b id='mZVIp'><form id='mZVIp'><ins id='mZVIp'></ins><ul id='mZVIp'></ul><sub id='mZVIp'></sub></form><legend id='mZVIp'></legend><bdo id='mZVIp'><pre id='mZVIp'><center id='mZVIp'></center></pre></bdo></b><th id='mZVIp'></th></span></q></dt></tr></i><div id='mZVIp'><tfoot id='mZVIp'></tfoot><dl id='mZVIp'><fieldset id='mZVIp'></fieldset></dl></div>
    1. <small id='mZVIp'></small><noframes id='mZVIp'>

    2. <tfoot id='mZVIp'></tfoot>

      1. “找不到 jpeg 的头文件或库文件"在 Alpine Li

        时间:2023-09-10

          <small id='vUkAM'></small><noframes id='vUkAM'>

          <tfoot id='vUkAM'></tfoot>

            <bdo id='vUkAM'></bdo><ul id='vUkAM'></ul>
                <tbody id='vUkAM'></tbody>

              1. <legend id='vUkAM'><style id='vUkAM'><dir id='vUkAM'><q id='vUkAM'></q></dir></style></legend>
              2. <i id='vUkAM'><tr id='vUkAM'><dt id='vUkAM'><q id='vUkAM'><span id='vUkAM'><b id='vUkAM'><form id='vUkAM'><ins id='vUkAM'></ins><ul id='vUkAM'></ul><sub id='vUkAM'></sub></form><legend id='vUkAM'></legend><bdo id='vUkAM'><pre id='vUkAM'><center id='vUkAM'></center></pre></bdo></b><th id='vUkAM'></th></span></q></dt></tr></i><div id='vUkAM'><tfoot id='vUkAM'></tfoot><dl id='vUkAM'><fieldset id='vUkAM'></fieldset></dl></div>
                  本文介绍了“找不到 jpeg 的头文件或库文件"在 Alpine Linux 上安装 Pillow的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我正在尝试在基于 python:alpine 的 Docker 容器中运行 Python 的 Scrapy.它以前可以工作,但现在我想使用 Scrapy 的 Image Pipeline 这需要我安装 Pillow.

                  I'm trying to run Python's Scrapy in a Docker container based on python:alpine. It was working before, but now I'd like to use Scrapy's Image Pipeline which requires me to install Pillow.

                  作为一个简化示例,我尝试了以下 Dockerfile:

                  As a simplified example, I tried the following Dockerfile:

                  FROM python:alpine
                  RUN apk --update add libxml2-dev libxslt-dev libffi-dev gcc musl-dev libgcc openssl-dev curl
                  RUN apk add libjpeg zlib tiff freetype lcms libwebp tcl openjpeg
                  RUN pip install Pillow
                  

                  但是,当我尝试构建它时,我收到一个错误,其中包含以下内容:

                  However, when I try to build this I get an error which contains the following:

                  Traceback (most recent call last):
                    File "/tmp/pip-build-ft5yzzuv/Pillow/setup.py", line 744, in <module>
                      zip_safe=not debug_build(), )
                    File "/usr/local/lib/python3.6/distutils/core.py", line 148, in setup
                      dist.run_commands()
                    File "/usr/local/lib/python3.6/distutils/dist.py", line 955, in run_commands
                      self.run_command(cmd)
                    File "/usr/local/lib/python3.6/distutils/dist.py", line 974, in run_command
                      cmd_obj.run()
                    File "/usr/local/lib/python3.6/site-packages/setuptools/command/install.py", line 61, in run
                      return orig.install.run(self)
                    File "/usr/local/lib/python3.6/distutils/command/install.py", line 545, in run
                      self.run_command('build')
                    File "/usr/local/lib/python3.6/distutils/cmd.py", line 313, in run_command
                      self.distribution.run_command(command)
                    File "/usr/local/lib/python3.6/distutils/dist.py", line 974, in run_command
                      cmd_obj.run()
                    File "/usr/local/lib/python3.6/distutils/command/build.py", line 135, in run
                      self.run_command(cmd_name)
                    File "/usr/local/lib/python3.6/distutils/cmd.py", line 313, in run_command
                      self.distribution.run_command(command)
                    File "/usr/local/lib/python3.6/distutils/dist.py", line 974, in run_command
                      cmd_obj.run()
                    File "/usr/local/lib/python3.6/distutils/command/build_ext.py", line 339, in run
                      self.build_extensions()
                    File "/tmp/pip-build-ft5yzzuv/Pillow/setup.py", line 545, in build_extensions
                      raise RequiredDependencyException(f)
                  __main__.RequiredDependencyException: jpeg
                  
                  During handling of the above exception, another exception occurred:
                  
                  Traceback (most recent call last):
                    File "<string>", line 1, in <module>
                    File "/tmp/pip-build-ft5yzzuv/Pillow/setup.py", line 756, in <module>
                      raise RequiredDependencyException(msg)
                  __main__.RequiredDependencyException:
                  
                  The headers or library files could not be found for jpeg,
                  a required dependency when compiling Pillow from source.
                  
                  Please see the install instructions at:
                     https://pillow.readthedocs.io/en/latest/installation.html
                  

                  我查看了 https://pillow.readthedocs.io/en/上的要求latest/installation.html 并试图找到 Alpine 的相应包,虽然我找不到 libimagequant,所以这可能是罪魁祸首".尽管如此,回溯和错误消息似乎是在说 jpeg 丢失,而我已经安装了 openjpeg.

                  I went through the requirements on https://pillow.readthedocs.io/en/latest/installation.html and tried to find the corresponding packages for Alpine, although one I couldn't find was libimagequant, so this might be the 'culprit'. Nonetheless, it the traceback and error message seem to be saying that jpeg is missing, whereas I have installed openjpeg.

                  如何修改 Dockerfile 以便 pip install Pillow 运行?

                  How can I modify the Dockerfile so that pip install Pillow runs?

                  推荐答案

                  在后面貌似被删除的评论中,有人指点我https://github.com/python-pillow/Pillow/blob/c05099f45c0d94a2a98c3609a96bdb6cf7446627/depends/alpine_Dockerfile

                  In a comment that appears to have been deleted later, someone pointed me to https://github.com/python-pillow/Pillow/blob/c05099f45c0d94a2a98c3609a96bdb6cf7446627/depends/alpine_Dockerfile. Based on that Dockerfile I modified my own as follows:

                  FROM python:alpine
                  RUN apk --update add libxml2-dev libxslt-dev libffi-dev gcc musl-dev libgcc openssl-dev curl
                  RUN apk add jpeg-dev zlib-dev freetype-dev lcms2-dev openjpeg-dev tiff-dev tk-dev tcl-dev
                  RUN pip install Pillow
                  

                  现在它构建成功了.

                  这篇关于“找不到 jpeg 的头文件或库文件"在 Alpine Linux 上安装 Pillow的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:Docker:该命令返回一个非零代码:137 下一篇:确定 docker 映像的操作系统分布

                  相关文章

                  最新文章

                • <small id='PDabc'></small><noframes id='PDabc'>

                  <tfoot id='PDabc'></tfoot>

                        <bdo id='PDabc'></bdo><ul id='PDabc'></ul>

                    1. <legend id='PDabc'><style id='PDabc'><dir id='PDabc'><q id='PDabc'></q></dir></style></legend>

                    2. <i id='PDabc'><tr id='PDabc'><dt id='PDabc'><q id='PDabc'><span id='PDabc'><b id='PDabc'><form id='PDabc'><ins id='PDabc'></ins><ul id='PDabc'></ul><sub id='PDabc'></sub></form><legend id='PDabc'></legend><bdo id='PDabc'><pre id='PDabc'><center id='PDabc'></center></pre></bdo></b><th id='PDabc'></th></span></q></dt></tr></i><div id='PDabc'><tfoot id='PDabc'></tfoot><dl id='PDabc'><fieldset id='PDabc'></fieldset></dl></div>