[英]How do I install PIL/Pillow for Python 3.6?
我有一個需要 PIL 才能運行的腳本。 除了降級我的 Python,我找不到在我的 Python 3.6 上安裝 PIL
這是我的嘗試:
pip install pil
Collecting pil
Could not find a version that satisfies the requirement pil (from versions: )
No matching distribution found for pil
pip install Pillow
Collecting Pillow
Using cached Pillow-3.3.1.zip
Installing collected packages: Pillow
Running setup.py install for Pillow ... error
Complete output from command c:\python\python36\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\ABDULR~1\\AppData\\Local\\Temp\\pip-build-rez5zpri\\Pillow\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record C:\Users\ABDULR~1\AppData\Local\Temp\pip-a5bugnjo-record\install-record.txt --single-version-externally-managed --compile:
Single threaded build for windows
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.6
creating build\lib.win-amd64-3.6\PIL
copying PIL\......................
..................................
..................................
running egg_info
writing Pillow.egg-info\PKG-INFO
writing dependency_links to Pillow.egg-info\dependency_links.txt
writing top-level names to Pillow.egg-info\top_level.txt
warning: manifest_maker: standard file '-c' not found
reading manifest file 'Pillow.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching '*.sh'
no previously-included directories found matching 'docs\_static'
warning: no previously-included files found matching '.coveragerc'
warning: no previously-included files found matching '.editorconfig'
warning: no previously-included files found matching '.landscape.yaml'
warning: no previously-included files found matching 'appveyor.yml'
warning: no previously-included files found matching 'build_children.sh'
warning: no previously-included files found matching 'tox.ini'
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
writing manifest file 'Pillow.egg-info\SOURCES.txt'
copying PIL\OleFileIO-README.md -> build\lib.win-amd64-3.6\PIL
running build_ext
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\ABDULR~1\AppData\Local\Temp\pip-build-rez5zpri\Pillow\setup.py", line 753, in <module>
zip_safe=not debug_build(), )
File "c:\python\python36\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "c:\python\python36\lib\distutils\dist.py", line 955, in run_commands
self.run_command(cmd)
File "c:\python\python36\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "c:\python\python36\lib\site-packages\setuptools\command\install.py", line 61, in run
return orig.install.run(self)
File "c:\python\python36\lib\distutils\command\install.py", line 539, in run
self.run_command('build')
File "c:\python\python36\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\python\python36\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "c:\python\python36\lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "c:\python\python36\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\python\python36\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "c:\python\python36\lib\distutils\command\build_ext.py", line 338, in run
self.build_extensions()
File "C:\Users\ABDULR~1\AppData\Local\Temp\pip-build-rez5zpri\Pillow\setup.py", line 521, in build_extensions
' using --disable-%s, aborting' % (f, f))
ValueError: zlib is required unless explicitly disabled using --disable-zlib, aborting
----------------------------------------
Command "c:\python\python36\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\ABDULR~1\\AppData\\Local\\Temp\\pip-build-rez5zpri\\Pillow\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record C:\Users\ABDULR~1\AppData\Local\Temp\pip-a5bugnjo-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\ABDULR~1\AppData\Local\Temp\pip-build-rez5zpri\Pillow\
不知道添加參數--disable-zlib
, pip install Pillow --disable-zlib
不正確。
在此處找不到與我的系統匹配的內容: https://pypi.python.org/pypi/Pillow/3.0.0
64 位 Windows 10 & Python 3.6
對於python版本2.x,您可以簡單地使用
pip install pillow
但對於python版本3.X,您需要指定
(sudo) pip3 install pillow
當你在bash hit標簽中輸入pip時,你會看到你有什么選擇
在Windows上發布帶有安裝輪的枕頭:
我們提供了Windows的Pillow二進制文件,這些二進制文件是為支持的Pythons矩陣編譯的,包括32位和64位版本的wheel,egg和可執行安裝程序。 這些二進制文件包含所有可選庫
https://pillow.readthedocs.io/en/3.3.x/installation.html#basic-installation
更新:Pillow現在支持Python 3.6。 使用pip install pillow
並查看https://pillow.readthedocs.io/en/latest/installation.html以獲取更多信息。
但是,Python 3.6仍然處於alpha狀態,尚未得到官方支持,盡管測試確實都通過了夜間Python構建(目前為3.6a4)。
https://travis-ci.org/python-pillow/Pillow/jobs/155605577
如果以某種方式可以安裝3.5轉3.6,這是你最好的選擇。
否則,zlib盡管如此,你需要從源代碼構建,需要一個MS Visual C ++編譯器,這並不簡單。
有關提示,請參閱
https://pillow.readthedocs.io/en/3.3.x/installation.html#building-from-source
還可以看看它是如何在AppVeyor CI上構建的(但還不是3.5或3.6):
https://github.com/python-pillow/Pillow/tree/master/winbuild
如果做不到這一點,Pillow支持降級到Python 3.5或等到3.6,可能更接近3.6的正式版本。
在Windows 10中,對於那些在PyCharm上編碼時努力安裝PIL/pillow並有Python 3.10.6的人,請執行以下操作;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.