PIL在windows和Ubuntu下的安装--pip安装方式

一、简介

PILPython Image Library Python)是python图像处理类库,提供了通用的图像处理功能,以及大量有用的基本图像操作,比图图像 的缩放、裁剪、旋转、颜色转换等,更重要的是,PIL是免费的。

二、安装

下面我们来讲解用pip安装PIL模块,适用于windowsLinux(本示例以windows为例安装):

打开windowscmd窗口或者Ubuntu的命令终端,输入以下命令:

 pip install pillow

 PIL在windows和Ubuntu下的安装--pip安装方式PIL在windows和Ubuntu下的安装--pip安装方式PIL在windows和Ubuntu下的安装--pip安装方式

等待数分钟即可安装成功。

三、遇到的问题

如果出现如下情况:

 PIL在windows和Ubuntu下的安装--pip安装方式PIL在windows和Ubuntu下的安装--pip安装方式PIL在windows和Ubuntu下的安装--pip安装方式

那是因为网络连接超时,是由于外网访问速度慢导致的,可以尝试翻墙,或者重新输入刚刚的命令,这就是看人品的时候了。

四、测试

最后,来一个简单的测试:

在cmd窗口中输入python,然后输入from PIL import Image,如果出现下图,则表示安装成功,可以在你的电脑上正常使用PIL模块了。

 PIL在windows和Ubuntu下的安装--pip安装方式PIL在windows和Ubuntu下的安装--pip安装方式PIL在windows和Ubuntu下的安装--pip安装方式

如果出现下图所示的提示,表示安装不成功,这是需要重新安装了,或者寻找其他原因了!!!

 PIL在windows和Ubuntu下的安装--pip安装方式PIL在windows和Ubuntu下的安装--pip安装方式PIL在windows和Ubuntu下的安装--pip安装方式

最后,希望对大家有帮助!!!