WarningsWarning Pillow and PIL cannot co-exist in the same environment. Before installing Pillow, please uninstall PIL. Warning Pillow >= 1.0 no longer supports “import Image”. Please use “from PIL import Image” instead. Warning Pillow >= 2.1.0 no longer supports “import _imaging”. Please use “from PIL.Image import core as _imaging” instead. NotesNote Pillow < 2.0.0 supports Python versions 2.4, 2.5, 2.6, 2.7. Note Pillow >= 2.0.0 < 4.0.0 supports Python versions 2.6, 2.7, 3.2, 3.3, 3.4, 3.5 Note Pillow >= 4.0.0 < 5.0.0 supports Python versions 2.7, 3.3, 3.4, 3.5, 3.6 Note Pillow >= 5.0.0 < 5.2.0 supports Python versions 2.7, 3.4, 3.5, 3.6 Note Pillow >= 5.2.0 supports Python versions 2.7, 3.4, 3.5, 3.6, 3.7 Basic InstallationNote The following instructions will install Pillow with support for most common image formats. See External Libraries for a full list of external libraries supported. Install Pillow with pip: $ pip install Pillow
Windows InstallationWe 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 except for raqm and libimagequant: > pip install Pillow
macOS InstallationWe provide binaries for macOS for each of the supported Python versions in the wheel format. These include support for all optional libraries except libimagequant. Raqm support requires libraqm, fribidi, and harfbuzz to be installed separately: $ pip install Pillow
Linux InstallationWe provide binaries for Linux for each of the supported Python versions in the manylinux wheel format. These include support for all optional libraries except libimagequant. Raqm support requires libraqm, fribidi, and harfbuzz to be installed separately: $ pip install Pillow
Most major Linux distributions, including Fedora, Debian/Ubuntu and ArchLinux also include Pillow in packages that previously contained PIL e.g. FreeBSD InstallationPillow can be installed on FreeBSD via the official Ports or Packages systems: Ports: $ cd /usr/ports/graphics/py-pillow && make install clean
Packages: $ pkg install py27-pillow
Note The Pillow FreeBSD port and packages are tested by the ports team with all supported FreeBSD versions and against Python 2.7 and 3.x. Building From SourceDownload and extract the compressed archive from PyPI. External LibrariesNote You do not need to install all supported external libraries to use Pillow’s basic features. Zlib and libjpeg are required by default. Note There are scripts to install the dependencies for some operating systems included in the Many of Pillow’s features require external libraries:
Once you have installed the prerequisites, run: $ pip install Pillow
If the prerequisites are installed in the standard library locations for your machine (e.g. $ CFLAGS="-I/usr/pkg/include" pip install pillow
If Pillow has been previously built without the required prerequisites, it may be necessary to manually clear the pip cache or build without cache using the Build Options
Sample usage: $ MAX_CONCURRENCY=1 python setup.py build_ext --enable-[feature] install
or using pip: $ pip install pillow --global-option="build_ext" --global-option="--enable-[feature]"
Building on macOSThe Xcode command line tools are required to compile portions of Pillow. The tools are installed by running The easiest way to install external libraries is via Homebrew. After you install Homebrew, run: $ brew install libtiff libjpeg webp little-cms2
To install libraqm on macOS use Homebrew to install its dependencies: $ brew install freetype harfbuzz fribidi
Then see Now install Pillow with: $ pip install Pillow
or from within the uncompressed source directory: $ python setup.py install
Building on WindowsWe don’t recommend trying to build on Windows. It is a maze of twisty passages, mostly dead ends. There are build scripts and notes for the Windows build in the Building on FreeBSDNote Only FreeBSD 10 and 11 tested Make sure you have Python’s development libraries installed.: $ sudo pkg install python2
Or for Python 3: $ sudo pkg install python3
Prerequisites are installed on FreeBSD 10 or 11 with: $ sudo pkg install jpeg-turbo tiff webp lcms2 freetype2 openjpeg harfbuzz fribidi
Then see Building on LinuxIf you didn’t build Python from source, make sure you have Python’s development libraries installed. In Debian or Ubuntu: $ sudo apt-get install python-dev python-setuptools
Or for Python 3: $ sudo apt-get install python3-dev python3-setuptools
In Fedora, the command is: $ sudo dnf install python-devel redhat-rpm-config
Or for Python 3: $ sudo dnf install python3-devel redhat-rpm-config
Note
Prerequisites are installed on Ubuntu 14.04 LTS with: $ sudo apt-get install libtiff5-dev libjpeg8-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev libharfbuzz-dev libfribidi-dev tcl8.6-dev tk8.6-dev python-tk
Then see Prerequisites are installed on recent RedHat Centos or Fedora with: $ sudo dnf install libtiff-devel libjpeg-devel zlib-devel freetype-devel lcms2-devel libwebp-devel tcl-devel tk-devel libraqm-devel libimagequant-devel
Note that the package manager may be yum or dnf, depending on the exact distribution. See also the Building on AndroidBasic Android support has been added for compilation within the Termux environment. The dependencies can be installed by: $ pkg -y install python python-dev ndk-sysroot clang make libjpeg-turbo-dev
This has been tested within the Termux app on ChromeOS, on x86. Platform SupportCurrent platform support for Pillow. Binary distributions are contributed for each release on a volunteer basis, but the source should compile and run everywhere platform support is listed. In general, we aim to support all current versions of Linux, macOS, and Windows. Continuous Integration TargetsThese platforms are built and tested for every change.
* Mac OS X CI is not run for every commit, but is run for every release. Other PlatformsThese platforms have been reported to work at the versions mentioned. Note Contributors please test Pillow on your platform then update this document and send a pull request.
Old VersionsYou can download old distributions from PyPI. Only the latest major releases for Python 2.x and 3.x are visible, but all releases are available by direct URL access e.g. https:///project/Pillow/1.0/. |
|
来自: KyunraWang > 《PIL》