Snow Leopard、Django 和 Django 的问题太平洋石油公司

发布于 2024-08-04 16:34:11 字数 384 浏览 5 评论 0原文

我在获取 Django & 时遇到了一些问题。升级到 Snow Leopard 后,PIL 工作正常。

我已经安装了 freetype、libjpeg,然后是 PIL,它告诉我:

--- TKINTER support ok
--- JPEG support ok
--- ZLIB (PNG/ZIP) support ok
--- FREETYPE2 support ok

但是当我尝试通过 django 管理界面上传 jpeg 时,我得到:

上传有效图像。文件你 上传的要么不是图像,要么是 图像损坏。

它适用于 PNG 文件。

有什么想法吗?

I am having some trouble getting Django & PIL work properly since upgrading to Snow Leopard.

I have installed freetype, libjpeg and then PIL, which tells me:

--- TKINTER support ok
--- JPEG support ok
--- ZLIB (PNG/ZIP) support ok
--- FREETYPE2 support ok

but when I try to upload a jpeg through the django admin interface I get:

Upload a valid image. The file you
uploaded was either not an image or a
corrupted image.

It works fine with PNG files.

Any Ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

落在眉间の轻吻 2024-08-11 16:34:11

Cato

我对 Leopard 10.5.x 有同样的经历
这是我所做的修复它的方法(可能不适合你)。

  1. 转到您的 PIL 工作文件夹(您解压 PIL 的位置)
    cd 到您的构建文件夹
    cd 到您的 lib.macosx-10.* 文件夹(特定于您的操作系统)
    删除*.so
    cd 返回到您的 PIL 构建文件夹
    (我为此以 su 身份登录,但如果您愿意,您可以 sudo 这些)
  2. python setup.py clean
  3. python setup.py build
  4. python setup.py install

这将重建 PIL clean。 jpeg 报告正常的原因是它只是查找 jpeg lib 文件是否存在,而不查找干净构建和安装 PIL 时发生的依赖关系。

希望这能解决您的问题,我的问题更可能与安装顺序有关,但也许会有所帮助......

Cato

I had the same experience with Leopard 10.5.x
Here is what I did to fix it, (may not work for you).

  1. Go to your PIL working folder (where you unzipped PIL)
    cd to your build folder
    cd to your lib.macosx-10.* folder (specific to your os)
    remove *.so
    cd back to your PIL build folder
    (I logged in as su for this, but you can sudo these if you like)
  2. python setup.py clean
  3. python setup.py build
  4. python setup.py install

This rebuilds PIL clean. The reason your jpeg reports ok, is that it just looks for the existence of the jpeg lib files, but not the dependency that happens from a clean build and install of PIL.

Hope this solves your problem, mine was more likely related to the order of installation but maybe it will help...

  • Ken
海未深 2024-08-11 16:34:11

作为 Ken 回复的后续内容,我在 Snow Leopard 10.6.x 中遇到了同样的问题,这是由于在 libjpeg 之前安装 PIL 造成的。安装 libjpeg 后,我通过执行以下操作重新安装了 PIL。

  1. cd 到 PIL 工作文件夹
  2. python setup.py clean
  3. python setup.py build_ext -i <-- 这将重建 PIL
  4. python selftest.py - 运行自测试以确认 PIL 已安装 ok
  5. python setup.py install

As a follow up to Ken's response, I had the same problem with Snow Leopard 10.6.x which was caused by installing PIL before libjpeg. After installing libjpeg, I reinstalled PIL by doing the following.

  1. cd to PIL working folder
  2. python setup.py clean
  3. python setup.py build_ext -i <-- This rebuilds PIL
  4. python selftest.py - Run the selftest to confirm PIL is installed ok
  5. python setup.py install
爱的那么颓废 2024-08-11 16:34:11

我在 Ubuntu 8.04 上遇到了类似的问题。我只需重新发布我的 PIL 安装(通过 pip)就可以摆脱困境:

pip install PIL --upgrade

不确定问题是什么,但我怀疑它与这里其他人报告的类似。

I ran into a similar issue while on Ubuntu 8.04. I was able to get myself out of it by simply re-issuing my PIL install (via pip):

pip install PIL --upgrade

Not sure what the issue was but I suspect it's similar to what others here reported.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文