使用 libjpeg 在 vi​​rtualenv 上安装 pil [英] install pil on virtualenv with libjpeg

查看:20
本文介绍了使用 libjpeg 在 vi​​rtualenv 上安装 pil的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前我正在将 PIL 安装到我的虚拟环境中,如下所示:

Currently I'm installing PIL into my virtual env as follows:

pip install -E . -r ./releases/%s/requirements.txt

其中 requirements.txt 包含:

where requirements.txt contains:

pil

我目前可以上传 png 图片,但不能上传 jpeg 图片.从网上阅读似乎我可能需要 libjpeg 解码器?我是否错误地安装了pil?使用 libjpeg 在虚拟环境中为 django 安装 pil 的正确方法是什么?

I can upload png images but not jpeg images currently. From reading on the web it seems i may need libjpeg decoder? Am i installing pil incorrectly? What is the proper way to install pil for django in a virtual env with libjpeg?

推荐答案

您应该安装其他人推荐的库,但最重要的是您应该告诉 PIL 在哪里可以找到它们.编辑 setup.py 以便

You should install the libraries that others recommended but most importantly you should tell PIL where to find them. Edit the setup.py so that

    JPEG_ROOT = None 

变成

JPEG_ROOT = libinclude("/usr/lib") 

我发现最简单的方法是使用 pip 下载源代码但不安装:

I found that the easiest way was to download the source with pip but not install:

 pip install --no-install PIL

编辑设置(在虚拟环境的构建目录中)和安装

edit the setup (inside the build directory of the virtual environment) and the install

 pip install PIL

您可以在我的中找到更多信息博客

您也可以尝试 pillow 这似乎做得很好,没有什么麻烦(pip install枕头)

You can also try pillow which seems to do great job with little hassle (pip install pillow)

这篇关于使用 libjpeg 在 vi​​rtualenv 上安装 pil的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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