Python3 PIL枕头Ubuntu安装 [英] Python3 PIL Pillow Ubuntu Install

查看:96
本文介绍了Python3 PIL枕头Ubuntu安装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行Ubuntu 14.04 LTS.我同时安装了Python 2.7和Python 3.4.在Linux上安装Python软件包时,我还是一个相对较新的人.

I'm running Ubuntu 14.04 LTS. I have both Python 2.7 and Python 3.4 installed. I'm relatively novice when it comes to installing Python Packages in Linux.

我只是试图安装并访问Python 3.4中的 PIL的图像库.我的理解是,这是通过安装PIL的现代叉子Pillow来实现的.

I'm just trying to install and get access to PIL's image library in Python 3.4. It is my understanding that this is achieved by installing Pillow, the modern fork of PIL.

似乎在挣扎中我设法成功地使PIL在Python 2.7中工作,但是我仍然无法使其在3.4中工作.

It seems in my floundering I managed to successfully get PIL working in Python 2.7, but I still cannot get it working in 3.4.

我得到了pippip3.当我输入

sudo pip3 install Pillow

我收到以下错误消息,表明它已安装:

I get the following error message, implying it is is installed:

Requirement already satisfied (use --upgrade to upgrade): Pillow in /usr/local/lib/python3.4/dist-packages
Cleaning up...

但是,当我尝试在Python 3.4中导入PIL或Pillow时,找不到该模块.

Yet when I try to import either PIL or Pillow in Python 3.4, the module is not found.

我觉得我只是缺少一些简单的东西.

I feel like I'm just missing something simple.

推荐答案

枕头打包为Ubuntu 14.04(Trusty Tahr)中的python3-pil.您可以通过以下方式在系统范围内安装它:

Pillow is packaged as python3-pil in Ubuntu 14.04 (Trusty Tahr). You can install it system-wide with:

sudo apt-get install python3-pil

您似乎早先已经用 pip 安装了Pillow,但是默认路径是它把它放入系统Python无法读取的位置. 您可以使用以下方法将其添加到搜索路径:

You seem to have already installed Pillow with pip earlier, but the default path it pip places it in is not read by the system Python. You can add it to the search path with:

export PYTHONPATH=/usr/local/lib/python3.4/dist-packages:/usr/local/lib/python3.4/site-packages

通常最好使用pip --user,以避免破坏系统安装或尽可能使用基本Python模块的打包变体.

Generally you are better off using pip --user to avoid breaking the system installations or to stick with the packaged variants of base Python modules if possible.

这篇关于Python3 PIL枕头Ubuntu安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆