PIL是Python平台事實上的圖像處理標准庫,需要用到圖片的需要導入該模塊
一 安裝pip
https://pip.pypa.io/en/stable/installing/#id8
1 python -m pip install -U pip
二 選擇PIL
官方沒有支持python3.6的PIL庫,所以用pillow代替
http://www.lfd.uci.edu/~gohlke/pythonlibs/#pillow
windows 64位 python36:選擇Pillow‑4.2.0‑cp36‑cp36m‑win_amd64.whl下載,保存在Scripts文件夾下
然后在~\Python36\Scripts目錄下按Shift+鼠標右鍵,選擇【在此處打開命令窗口】輸入命令:
python -m pip install --upgrade pip 先升級
1 pip install Pillow-4.1.0-cp36-cp36m-win64.whl
三pillow下載完成后可以導入pillow模塊使用
1 2 import Image, ImageFilter, ImageDraw, ImageFont, ImageEnhance, ImageFilter