2016-08-27 60 views
14

Tôi có một tập lệnh yêu cầu PIL chạy. Khác với hạ Python của tôi, tôi không thể tìm thấy anyway để cài đặt PIL trên Python 3.6Làm cách nào để cài đặt PIL/Pillow cho Python 3.6?

Dưới đây là những nỗ lực của tôi:

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\ 

Không biết thêm lập luận --disable-zlib, pip install Pillow --disable-zlib là không đúng.

Không thể tìm thấy những gì phù hợp với hệ thống của tôi ở đây: https://pypi.python.org/pypi/Pillow/3.0.0

64-bit Windows 10 & Python 3.6

Trả lời

13

Đối với phiên bản python 2.x bạn chỉ có thể sử dụng

  • pip install pillow

Nhưng đối với phiên bản python 3.X bạn cần chỉ định

  • (sudo) pip3 install pillow

khi bạn nhập pip trong bash nhấn tab và bạn sẽ thấy những tùy chọn bạn có

+0

Tôi gặp lỗi tương tự (khoảng zlib bị thiếu) với 'pip3 install pillow'. Làm cách nào để thêm --disable-zlib vào lệnh? Hoặc cài đặt zlib tốt hơn. Tôi không chắc chắn nếu kịch bản của tôi yêu cầu zlib –

+0

Đây không thực sự là câu trả lời cho câu hỏi cụ thể này. Rõ ràng từ câu hỏi rằng OP đang sử dụng pip theo Python 3.6. – arokem

0

Gối được phát hành với bánh xe cài đặt trên Windows:

Chúng tôi cung cấp các tệp nhị phân cho Windows được biên dịch cho ma trận được hỗ trợ Pythons trong cả phiên bản 32 và 64 bit trong bánh xe, trứng, và trình cài đặt có thể thực thi. Những mã nhị phân có tất cả các thư viện tùy chọn bao gồm

https://pillow.readthedocs.io/en/3.3.x/installation.html#basic-installation

Cập nhật: Python 3.6 hiện đang được hỗ trợ bởi nhiều loại gối. Cài đặt với pip install pillow và kiểm tra https://pillow.readthedocs.io/en/latest/installation.html để biết thêm thông tin.


Tuy nhiên, Python 3.6 vẫn đang trong alpha và không chính thức hỗ trợ nào, mặc dù các bài kiểm tra làm tất cả những đường chuyền cho Python đêm xây dựng (hiện 3.6a4).

https://travis-ci.org/python-pillow/Pillow/jobs/155605577

Nếu đó là bằng cách nào đó có thể cài đặt các bánh xe 3.5 cho 3.6, đó là đặt cược tốt nhất của bạn. Nếu không, zlib bất kể, bạn sẽ cần phải xây dựng từ nguồn, yêu cầu một trình biên dịch MS Visual C++, và đó không phải là đơn giản. Đối với mẹo, hãy xem:

https://pillow.readthedocs.io/en/3.3.x/installation.html#building-from-source

Và cũng xem làm thế nào nó được xây dựng cho Windows trên AppVeyor CI (nhưng chưa được 3.5 hay 3.6):

https://github.com/python-pillow/Pillow/tree/master/winbuild

Không đó, hạ cấp xuống Python 3.5 hoặc đợi cho đến khi 3.6 được hỗ trợ bởi Pillow, có lẽ gần hơn với bản phát hành chính thức của 3.6.

1

Bạn có thể tải bánh xe tương ứng với cấu hình của bạnhere ("Gối-4.1.1-cp36-cp36m-win_amd64.whl" trong trường hợp của bạn) và cài đặt nó với:

pip install some-package.whl

Nếu bạn gặp sự cố khi cài đặt bánh xe, hãy đọc this answer

+0

Tệ của tôi Tôi không thấy đó là một bài đăng cũ – Gabriel

Các vấn đề liên quan