簡體   English   中英

我正在嘗試使用“pip install Pillow”安裝枕頭,但出現錯誤

[英]I am trying to install pillow using 'pip install Pillow' but I am getting error

Error:       
    `(env) E:\Python Projects\Flask\Flask Blog>pip install pillow
        Collecting pillow
          Using cached Pillow-7.2.0.tar.gz (39.1 MB)
        Building wheels for collected packages: pillow
          Building wheel for pillow (setup.py) ... error
          ERROR: Command errored out with exit status 1:
           command: 'e:\python projects\flask\env\scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Gaming\\AppData\\Local\\Temp\\pip-install-boxgam9w\\pillow\\setup.py'"'"'; __file__='"'"'C:\\Users\\Gaming\\AppData\\Local\\Temp\\pip-install-boxgam9w\\pillow\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\Gaming\AppData\Local\Temp\pip-wheel-xk_48jkq'
               cwd: C:\Users\Gaming\AppData\Local\Temp\pip-install-boxgam9w\pillow\
          Complete output (172 lines):
          C:\Users\Gaming\AppData\Local\Temp\pip-install-boxgam9w\pillow\setup.py:42: RuntimeWarning: Pillow 7.2.0 does not support Python 3.9 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-3.9
          creating build\lib.win-amd64-3.9\PIL
          copying src\PIL\BdfFontFile.py -> build\lib.win-amd64-3.9\PIL
          copying src\PIL\BlpImagePlugin.py -> build\lib.win-amd64-3.9\PIL...
          ...


          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'
          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\Gaming\AppData\Local\Temp\pip-install-boxgam9w\pillow\setup.py", line 864, in <module>
              setup(
            File "e:\python projects\flask\env\lib\site-packages\setuptools\__init__.py", line 153, in setup
              return distutils.core.setup(**attrs)
            File "C:\Users\Gaming\AppData\Local\Programs\Python\Python39\lib\distutils\core.py", line 148, in setup...
              ...
              ...

在處理上述異常的過程中,又發生了一個異常:

          Traceback (most recent call last):
            File "<string>", line 1, in <module>
            File "C:\Users\Gaming\AppData\Local\Temp\pip-install-boxgam9w\pillow\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
        
        
          ----------------------------------------
          ERROR: Failed building wheel for pillow
          Running setup.py clean for pillow
        Failed to build pillow
        Installing collected packages: pillow
            Running setup.py install for pillow ... error
            ERROR: Command errored out with exit status 1:
             command: 'e:\python projects\flask\env\scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Gaming\\AppData\\Local\\Temp\\pip-install-boxgam9w\\pillow\\setup.py'"'"'; __file__='"'"'C:\\Users\\Gaming\\AppData\\Local\\Temp\\pip-install-boxgam9w\\pillow\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Gaming\AppData\Local\Temp\pip-record-8oe6sa1m\install-record.txt' --single-version-externally-managed --compile --install-headers 'e:\python projects\flask\env\include\site\python3.9\pillow'
                 cwd: C:\Users\Gaming\AppData\Local\Temp\pip-install-boxgam9w\pillow\
            Complete output (174 lines):
            C:\Users\Gaming\AppData\Local\Temp\pip-install-boxgam9w\pillow\setup.py:42: RuntimeWarning: Pillow 7.2.0 does not support Python 3.9 and does not provide prebuilt Windows binaries. We do not recommend building from source on Windows.
              warnings.warn(
            running install
            running build
            running build_py
            creating build
            creating build\lib.win-amd64-3.9
            creating build\lib.win-amd64-3.9\PIL
            copying src\PIL\BdfFontFile.py -> build\lib.win-amd64-3.9\PIL
            copying src\PIL\BlpImagePlugin.py -> build\lib.win-amd64-3.9\PIL
            copying src\PIL\BmpImagePlugin.py -> build\lib.win-amd64-3.9\PIL
            copying src\PIL\BufrStubImagePlugin.py -> build\lib.win-amd64-3.9\PIL
            copying src\PIL\ContainerIO.py -> build\lib.win-amd64-3.9\PIL
            copying src\PIL\CurImagePlugin.py -> build\lib.win-amd64-3.9\PIL...
            ...


            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 matching '*.so' found anywhere in distribution
            no previously-included directories found matching '.ci'
            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\Gaming\AppData\Local\Temp\pip-install-boxgam9w\pillow\setup.py", line 864, in <module>
                setup(
              File "e:\python projects\flask\env\lib\site-packages\setuptools\__init__.py", line 153, in setup
                return distutils.core.setup(**attrs)...
               ...

        
            Traceback (most recent call last):
              File "<string>", line 1, in <module>
              File "C:\Users\Gaming\AppData\Local\Temp\pip-install-boxgam9w\pillow\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
        
        
            ----------------------------------------
        ERROR: Command errored out with exit status 1: 'e:\python projects\flask\env\scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Gaming\\AppData\\Local\\Temp\\pip-install-boxgam9w\\pillow\\setup.py'"'"'; __file__='"'"'C:\\Users\\Gaming\\AppData\\Local\\Temp\\pip-install-boxgam9w\\pillow\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Gaming\AppData\Local\Temp\pip-record-8oe6sa1m\install-record.txt' --single-version-externally-managed --compile --install-headers 'e:\python projects\flask\env\include\site\python3.9\pillow' Check the logs for full command output.`

我是 Flask 的初學者,安裝時出現此錯誤。 我的 pip 版本是 20.2.3。 我的python版本是3.9。 我也嘗試使用pip install PIL安裝 Pillow,但它無論如何都不起作用。 我使用的是 Windows 10。所以請你幫我使用 pip 安裝 Pillow。

答案不是很清楚,但顯示在“完整輸出(172行)”的第一行:

C:\\Users\\Gaming\\AppData\\Local\\Temp\\pip-install-boxgam9w\\pillow\\setup.py:42: RuntimeWarning: Pillow 7.2.0 不支持 Python 3.9 並且不提供預構建的 Windows 二進制文件。 我們不建議在 Windows 上從源代碼構建。

Pillow 8.0.0 將於下周發布,並將支持 Python 3.9。

看:

編輯:支持 Python 3.9 的 Pillow 8.0.0 現已推出! https://pillow.readthedocs.io/en/stable/releasenotes/8.0.0.html

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM