在虚拟主机上使用 PIL

发布于 2024-09-15 19:44:11 字数 284 浏览 5 评论 0原文

我希望能够在网络托管计算机上使用 PIL 库。该机器安装了Python 2.4.3,但没有安装PIL库。我尝试下载 PIL 源并将 PIL 文件夹放入我的目录中。它有点有效,除了当我需要进行一些实际的图像处理时,这会引发一个 ImportError,指出“未安装 _imaging C 模块”。谷歌搜索一下,似乎我需要将 _imaging.so 文件放入 PIL 文件夹中,但我在网上找不到预编译的文件。

在这一点上,我不确定我是否走在正确的轨道上。从这里我应该做什么?任何帮助表示赞赏。

谢谢。

I want to be able to use the PIL library on a web hosting machine. The machine has Python 2.4.3 installed, but not the PIL library. I tried downloading the PIL source and putting the PIL folder into my directory. It kind of works, except when I need to do some actual image processing, which brings up an ImportError, saying that "The _imaging C module is not installed". Googling this, it seems like I would need to throw an _imaging.so file into the PIL folder, but I couldn't find a precompiled one online.

At this point, I'm not sure if I'm even on the right track. What should I do from here? Any help is appreciated.

Thanks.

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

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

发布评论

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

评论(2

Smile简单爱 2024-09-22 19:44:11

您需要编译该模块。运行 setup.py install 命令应该可以为您完成此操作,前提是主机具有可用的编译器和所需的库。您可以使用 virtualenv 将其安装在您有权放置文件的位置(默认情况下它会尝试在系统范围内安装)。

如果它没有可用的编译器和正确的库和头文件,那么您需要在具有相同架构的另一台计算机上编译它并复制它,或者找到您的主机正在运行的任何操作系统的软件包并提取正确的包来自他们的文件。

顺便说一句,只要求他们安装 PIL 也可以!

You need to compile that module. Running the setup.py install command should do it for you, provided the host has a working compiler and the required libraries. You can use virtualenv to have it installed somewhere where you have rights to put files (by default it would try to install it system-wide).

If it doesn't have a working compiler and right libraries and header files, then you need to either compile it on another computer with the same architecture and copy it, or find the packages for whatever operating system your host is running and extract the right files from them.

By the way, just asking them to install PIL could work too!

樱花落人离去 2024-09-22 19:44:11

我知道这不是一个程序化的答案,但是......你应该切换网络主机。

当这么多问题已经得到解决时,没有充分的理由使用 Python 2.4 并处理旧的东西。我推荐 WebFaction 但任何运行现代操作系统/Python 安装的主机都可以(Ubuntu 在这方面确实是最简单的)观点)。

I know this isn't a programmatic answer but ... you should switch webhosts.

There is no good reason to be using Python 2.4 and dealing with old stuff when so many problems have been fixed already. I recommend WebFaction but any host running a modern OS/Python installation is fine (Ubuntu is really the easiest at this point).

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