在Python 3.6中安装PIL(Python Imaging Library)的官方版本不再支持,因此您应该安装Pillow,它是PIL的一个分支,并且支持Python 3.6及以上版本。以下是安装Pillow的步骤:
1. 确保您已经安装了Python 3.6。
2. 打开命令提示符(以管理员身份运行)。
3. 使用pip安装Pillow:
pip install pillow
如果您在安装过程中遇到网络问题,可以尝试使用国内的镜像源来加速下载,例如清华大学的镜像源:
pip install Pillow -i https://pypi.tuna.tsinghua.edu.cn/simple
安装完成后,您可以通过以下方式导入Pillow库并使用其功能:
from PIL import Image, ImageFilter, ImageDraw, ImageFont, ImageEnhance, ImageFilter