我无法安装Image_slicer库

I cant install Image_slicer library

提问人:Jonathan 提问时间:10/13/2022 最后编辑:Jonathan 更新时间:10/13/2022 访问量:415

问:

我正在尝试安装image_slicer,但 pip 无法安装 PIL,这是它的依赖项之一。我可以很好地安装最新版本的 PIL,但image_slicer想要一个不同的版本。那个我自己无法下载。只需阅读错误的底部即可。 我从错误消息中删除了很多重复的内容,但没有删除任何无关紧要的内容。我使用 Python 3.10 ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎

PS I:\Python Files> pip install image_slicer
Collecting image_slicer
  Using cached image_slicer-2.1.1-py2.py3-none-any.whl (8.3 kB)
Collecting Pillow==7.2.0
  Using cached Pillow-7.2.0.tar.gz (39.1 MB)
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: Pillow
  Building wheel for Pillow (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [184 lines of output]
      C:\Users\jonat\AppData\Local\Temp\pip-install-rl31cwgw\pillow_84b6d513380140eb80330a2fd902d6ea\setup.py:42: RuntimeWarning: Pillow 7.2.0 does not support Python 3.10 and 
does not provide prebuilt Windows binaries. We do not recommend building from source on Windows.
        warnings.warn(
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build\lib.win-amd64-cpython-310
      creating build\lib.win-amd64-cpython-310\PIL
      copying src\PIL\BdfFontFile.py -> build\lib.win-amd64-cpython-310\PIL
      copying src\PIL\BlpImagePlugin.py -> build\lib.win-amd64-cpython-310\PIL
      copying src\PIL\PSDraw.py -> build\lib.win-amd64-cpython-310\PIL
      copying src\PIL\PyAccess.py -> build\lib.win-amd64-cpython-310\PIL
      copying src\PIL\SgiImagePlugin.py -> build\lib.win-amd64-cpython-310\PIL
      copying src\PIL\SpiderImagePlugin.py -> build\lib.win-amd64-cpython-310\PIL
      copying src\PIL\SunImagePlugin.py -> build\lib.win-amd64-cpython-310\PIL
      copying src\PIL\TarIO.py -> build\lib.win-amd64-cpython-310\PIL
      copying src\PIL\TgaImagePlugin.py -> build\lib.win-amd64-cpython-310\PIL
      copying src\PIL\TiffImagePlugin.py -> build\lib.win-amd64-cpython-310\PIL
      copying src\PIL\TiffTags.py -> build\lib.win-amd64-cpython-310\PIL
      copying src\PIL\WalImageFile.py -> build\lib.win-amd64-cpython-310\PIL
      copying src\PIL\WebPImagePlugin.py -> build\lib.win-amd64-cpython-310\PIL
      copying src\PIL\WmfImagePlugin.py -> build\lib.win-amd64-cpython-310\PIL
      copying src\PIL\XbmImagePlugin.py -> build\lib.win-amd64-cpython-310\PIL
      copying src\PIL\XpmImagePlugin.py -> build\lib.win-amd64-cpython-310\PIL
      copying src\PIL\XVThumbImagePlugin.py -> build\lib.win-amd64-cpython-310\PIL
      copying src\PIL\_binary.py -> build\lib.win-amd64-cpython-310\PIL
      copying src\PIL\_tkinter_finder.py -> build\lib.win-amd64-cpython-310\PIL
      copying src\PIL\_util.py -> build\lib.win-amd64-cpython-310\PIL
      copying src\PIL\_version.py -> build\lib.win-amd64-cpython-310\PIL
      copying src\PIL\__init__.py -> build\lib.win-amd64-cpython-310\PIL
      copying src\PIL\__main__.py -> build\lib.win-amd64-cpython-310\PIL
      running egg_info
      writing src\Pillow.egg-info\PKG-INFO
      writing dependency_links to src\Pillow.egg-info\dependency_links.txt
      writing top-level names to src\Pillow.egg-info\top_level.txt
      reading manifest file 'src\Pillow.egg-info\SOURCES.txt'
      reading manifest template 'MANIFEST.in'
      warning: no files found matching '*.c'
      warning: no files found matching '*.h'
      warning: no files found matching '*.sh'
      warning: no previously-included files found matching '.appveyor.yml'
      warning: no previously-included files found matching '.coveragerc'
      warning: no previously-included files found matching '.editorconfig'
      warning: no previously-included files found matching '.readthedocs.yml'
      warning: no previously-included files found matching 'codecov.yml'
      warning: no previously-included files matching '.git*' found anywhere in distribution
      warning: no previously-included files matching '*.pyc' found anywhere in distribution
      warning: no previously-included files matching '*.so' found anywhere in distribution
      no previously-included directories found matching '.ci'
      adding license file 'LICENSE'
      writing manifest file 'src\Pillow.egg-info\SOURCES.txt'
      running build_ext
     
     
      The headers or library files could not be found for zlib,
      a required dependency when compiling Pillow from source.
      
      Please see the install instructions at:
         https://pillow.readthedocs.io/en/latest/installation.html
     
      Traceback (most recent call last):
        File "C:\Users\jonat\AppData\Local\Temp\pip-install-rl31cwgw\pillow_84b6d513380140eb80330a2fd902d6ea\setup.py", line 864, in <module>
          setup(
        File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2032.0_x64__qbz5n2kfra8p0\lib\site-packages\setuptools\__init__.py", line 87, in setup     
          return distutils.core.setup(**attrs)
        File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2032.0_x64__qbz5n2kfra8p0\lib\site-packages\setuptools\_distutils\core.py", line 177, in setup
          return run_commands(dist)
        File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2032.0_x64__qbz5n2kfra8p0\lib\site-packages\setuptools\_distutils\core.py", line 193, in run_commands
          dist.run_commands()
        File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2032.0_x64__qbz5n2kfra8p0\lib\site-packages\setuptools\_distutils\dist.py", line 968, in run_commands
          self.run_command(cmd)
        File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2032.0_x64__qbz5n2kfra8p0\lib\site-packages\setuptools\dist.py", line 1217, in run_command 
          super().run_command(command)
        File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2032.0_x64__qbz5n2kfra8p0\lib\site-packages\setuptools\_distutils\dist.py", line 987, in run_command
          cmd_obj.run()
        File "C:\Users\jonat\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\wheel\bdist_wheel.py", 
line 299, in run
          self.run_command('build')
        File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2032.0_x64__qbz5n2kfra8p0\lib\site-packages\setuptools\_distutils\cmd.py", line 317, in run_command
          self.distribution.run_command(command)
        File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2032.0_x64__qbz5n2kfra8p0\lib\site-packages\setuptools\dist.py", line 1217, in run_command 
          super().run_command(command)
        File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2032.0_x64__qbz5n2kfra8p0\lib\site-packages\setuptools\_distutils\dist.py", line 987, in run_command
          cmd_obj.run()
        File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2032.0_x64__qbz5n2kfra8p0\lib\site-packages\setuptools\command\build.py", line 24, in run  
          super().run()
        File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2032.0_x64__qbz5n2kfra8p0\lib\site-packages\setuptools\_distutils\command\build.py", line 131, in run
          self.run_command(cmd_name)
        File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2032.0_x64__qbz5n2kfra8p0\lib\site-packages\setuptools\_distutils\cmd.py", line 317, in run_command
          self.distribution.run_command(command)
        File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2032.0_x64__qbz5n2kfra8p0\lib\site-packages\setuptools\dist.py", line 1217, in run_command 
          super().run_command(command)
        File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2032.0_x64__qbz5n2kfra8p0\lib\site-packages\setuptools\_distutils\dist.py", line 987, in run_command
          cmd_obj.run()
        File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2032.0_x64__qbz5n2kfra8p0\lib\site-packages\setuptools\_distutils\command\build_ext.py", line 339, in run
          self.build_extensions()
        File "C:\Users\jonat\AppData\Local\Temp\pip-install-rl31cwgw\pillow_84b6d513380140eb80330a2fd902d6ea\setup.py", line 694, in build_extensions
          raise RequiredDependencyException(f)
      __main__.RequiredDependencyException: zlib
     
      During handling of the above exception, another exception occurred:
     
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "C:\Users\jonat\AppData\Local\Temp\pip-install-rl31cwgw\pillow_84b6d513380140eb80330a2fd902d6ea\setup.py", line 918, in <module>
          raise RequiredDependencyException(msg)
      __main__.RequiredDependencyException:
     
      The headers or library files could not be found for zlib,
      a required dependency when compiling Pillow from source.
     
      Please see the install instructions at:
         https://pillow.readthedocs.io/en/latest/installation.html
     
     
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for Pillow
  Running setup.py clean for Pillow
Failed to build Pillow
Installing collected packages: Pillow, image_slicer
  Attempting uninstall: Pillow
    Found existing installation: Pillow 9.2.0
    Uninstalling Pillow-9.2.0:
      Successfully uninstalled Pillow-9.2.0
  Running setup.py install for Pillow ... error
  error: subprocess-exited-with-error

  × Running setup.py install for Pillow did not run successfully.
  │ exit code: 1
  ╰─> [188 lines of output]
      C:\Users\jonat\AppData\Local\Temp\pip-install-rl31cwgw\pillow_84b6d513380140eb80330a2fd902d6ea\setup.py:42: RuntimeWarning: Pillow 7.2.0 does not support Python 3.10 and 
does not provide prebuilt Windows binaries. We do not recommend building from source on Windows.
        warnings.warn(
      running install
      C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2032.0_x64__qbz5n2kfra8p0\lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      running build
      running build_py
      creating build
      creating build\lib.win-amd64-cpython-310
      creating build\lib.win-amd64-cpython-310\PIL
      copying src\PIL\BdfFontFile.py -> build\lib.win-amd64-cpython-310\PIL
      copying src\PIL\BlpImagePlugin.py -> build\lib.win-amd64-cpython-310\PIL
      copying src\PIL\BmpImagePlugin.py -> build\lib.win-amd64-cpython-310\PI
      copying src\PIL\_version.py -> build\lib.win-amd64-cpython-310\PIL
      copying src\PIL\__init__.py -> build\lib.win-amd64-cpython-310\PIL
      copying src\PIL\__main__.py -> build\lib.win-amd64-cpython-310\PIL
      running egg_info
      writing src\Pillow.egg-info\PKG-INFO
      writing dependency_links to src\Pillow.egg-info\dependency_links.txt
      writing top-level names to src\Pillow.egg-info\top_level.txt
      reading manifest file 'src\Pillow.egg-info\SOURCES.txt'
      reading manifest template 'MANIFEST.in'
      warning: no files found matching '*.c'
      warning: no files found matching '*.h'
      warning: no files found matching '*.sh'
      warning: no previously-included files found matching '.appveyor.yml'
      warning: no previously-included files found matching '.coveragerc'
      warning: no previously-included files found matching '.editorconfig'
      warning: no previously-included files found matching '.readthedocs.yml'
      warning: no previously-included files found matching 'codecov.yml'
      warning: no previously-included files matching '.git*' found anywhere in distribution
      warning: no previously-included files matching '*.pyc' found anywhere in distribution
      warning: no previously-included files matching '*.so' found anywhere in distribution
      no previously-included directories found matching '.ci'
      adding license file 'LICENSE'
      writing manifest file 'src\Pillow.egg-info\SOURCES.txt'
      running build_ext
     
     
      The headers or library files could not be found for zlib,
      a required dependency when compiling Pillow from source.
     
      Please see the install instructions at:
         https://pillow.readthedocs.io/en/latest/installation.html
     
      Traceback (most recent call last):
        File "C:\Users\jonat\AppData\Local\Temp\pip-install-rl31cwgw\pillow_84b6d513380140eb80330a2fd902d6ea\setup.py", line 864, in <module>
          setup(
        File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2032.0_x64__qbz5n2kfra8p0\lib\site-packages\setuptools\__init__.py", line 87, in setup     
          return distutils.core.setup(**attrs)
        File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2032.0_x64__qbz5n2kfra8p0\lib\site-packages\setuptools\_distutils\core.py", line 177, in setup
          return run_commands(dist)
        File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2032.0_x64__qbz5n2kfra8p0\lib\site-packages\setuptools\_distutils\cmd.py", line 317, in run_command
          self.distribution.run_command(command)
        File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2032.0_x64__qbz5n2kfra8p0\lib\site-packages\setuptools\dist.py", line 1217, in run_command 
          super().run_command(command)
        File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2032.0_x64__qbz5n2kfra8p0\lib\site-packages\setuptools\_distutils\dist.py", line 987, in run_command
          cmd_obj.run()
        File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2032.0_x64__qbz5n2kfra8p0\lib\site-packages\setuptools\_distutils\command\build_ext.py", line 339, in run
          self.build_extensions()
        File "C:\Users\jonat\AppData\Local\Temp\pip-install-rl31cwgw\pillow_84b6d513380140eb80330a2fd902d6ea\setup.py", line 694, in build_extensions
          raise RequiredDependencyException(f)
      __main__.RequiredDependencyException: zlib
     
      During handling of the above exception, another exception occurred:
     
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "C:\Users\jonat\AppData\Local\Temp\pip-install-rl31cwgw\pillow_84b6d513380140eb80330a2fd902d6ea\setup.py", line 918, in <module>
          raise RequiredDependencyException(msg)
      __main__.RequiredDependencyException:
     
      The headers or library files could not be found for zlib,
      a required dependency when compiling Pillow from source.
     
      Please see the install instructions at:
         https://pillow.readthedocs.io/en/latest/installation.html
     
     
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  Rolling back uninstall of Pillow
  Moving to c:\users\jonat\appdata\local\packages\pythonsoftwarefoundation.python.3.10_qbz5n2kfra8p0\localcache\local-packages\python310\site-packages\pil\
   from C:\Users\jonat\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\~il
  Moving to c:\users\jonat\appdata\local\packages\pythonsoftwarefoundation.python.3.10_qbz5n2kfra8p0\localcache\local-packages\python310\site-packages\pillow-9.2.0.dist-info\  
   from C:\Users\jonat\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\~illow-9.2.0.dist-info       
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> Pillow
python pip python-imaging-library 图像切片器

评论


答:

0赞 J_H 10/13/2022 #1

您尝试从 pypi 安装,您解释说这很难。

相反,请使用 condahttps://anaconda.org/conda-forge/pillow 安装,这很容易。 二进制轮排除了找出 zlib dev 文件详细信息的需要。