如何为Python 3.6安装PIL / Pillow?

How do I install PIL/Pillow for Python 3.6?

我有一个脚本需要运行pil。除了降级我的python之外,我找不到在我的python 3.6上安装pil的方法。

以下是我的尝试:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
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('

', '
'), __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('

', '
'), __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-zlibpip install Pillow --disable-zlib不正确。

在这里找不到与我的系统匹配的内容:https://pypi.python.org/pypi/bellow/3.0.0

64位Windows 10&python 3.6


对于python 2.x版,您可以简单地使用

  • pip install pillow

但对于python 3.x版,您需要指定

  • 江户十一〔一〕号

当您在bash hit选项卡中输入pip时,您将看到您有哪些选项


您可以在此处下载与您的配置相对应的车轮("枕头"?4.1.1?CP36?CP36M?赢取"amd64.whl",并安装:

埃多克斯1〔3〕

如果安装车轮有问题,请阅读此答案


在窗户上用安装轮松开枕头:

We provide Pillow binaries for Windows
compiled for the matrix of supported Pythons
in both 32 and 64-bit versions in wheel, egg,
and executable installers. These binaries have
all of the optional libraries included

https://bellow.readthedocs.io/en/3.3.x/installation.html基本安装

更新:python 3.6现在由枕头支持。使用pip install pillow安装,并查看https://bellow.readthedocs.io/en/latest/installation.html了解更多信息。

然而,python 3.6仍然是alpha版本,还没有正式支持,尽管测试都通过了夜间的python构建(目前是3.6a4)。

https://travis-ci.org/python-bellow/bellow/jobs/155605577

如果能以某种方式安装3.6的3.5轮子,那是你最好的选择。否则,尽管ZLIB,您需要从源建立,需要MS VisualC++编译器,这并不简单。有关提示,请参阅:

https://bellow.readthedocs.io/en/3.3.x/installation.html从源代码构建

还可以查看它是如何在Appveyor CI上为Windows构建的(但还没有3.5或3.6):

https://github.com/python-bellow/bellow/tree/master/winbuild

如果失败,请降级到python 3.5或等到枕头支持3.6,可能更接近3.6的官方版本。