mac ValueError: zlib is required unless explicitly disabled using --disable-zlib, aborting

安装 pip install Pillow==3.4.1 的时候出错

ValueError: zlib is required unless explicitly disabled using --disable-zlib, aborting
Command "/Users/yangda/.virtualenvs/odoo-11.0/bin/python -u -c "import setuptools, tokenize;file='/private/tmp/pip-build-yaasygck/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 /tmp/pip-ewnmibv8-record/install-record.txt --single-version-externally-managed --compile --install-headers /Users/yangda/.virtualenvs/odoo-11.0/include/site/python3.6/Pillow" failed with error code 1 in /private/tmp/pip-build-yaasygck/Pillow/

原因是pillow在3.0以上的版本需要有依赖库, libjpeg和zlib

mac安装方法:

  1. 打开终端窗口, 粘贴以下脚本。安装brew
 /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  1. 通过brew安装libjpeg
brew install libjpeg zlib
  1. 通过brew安装zlib
brew tap homebrew/dupes
brew install zlib
brew link zlib --force

之后再正常安装pillow即可

其他平台,windows和linux安装方法可去:
官网查询
中文文档传送

你可能感兴趣的:(mac ValueError: zlib is required unless explicitly disabled using --disable-zlib, aborting)