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的初学者,安装时出现此错误。
我的点子版本是20.2.3。
我的python版本是3.9。
我也尝试使用pip install PIL
安装Pillow,但仍然无法正常工作。
我正在使用Windows 10。
所以,请您帮我用pip安装Pillow。
答案 0 :(得分:0)
答案不是很清楚,但是显示在“完整输出(172行)”的第一行:
C:\ Users \ Gaming \ AppData \ Local \ Temp \ pip-install-boxgam9w \ pillow \ setup.py:42:RuntimeWarning:Pillow 7.2.0不支持Python 3.9,并且不提供预构建的Windows二进制文件。我们不建议在Windows上从源代码构建。
枕头8.0.0将于下周发布,并将支持Python 3.9。
请参阅:
编辑:支持Python 3.9的枕头8.0.0现已发布! https://pillow.readthedocs.io/en/stable/releasenotes/8.0.0.html