简体   繁体   English

如何在Netbeans 6.8(Python版本2.6.5)中使用PIL

[英]How can I use PIL with Netbeans 6.8 (Python version 2.6.5)

I have installed Python Imaging Library (PIL) version 1.1.7 on a Windows 7 computer. 我已经在Windows 7计算机上安装了Python Imaging Library(PIL)版本1.1.7。 I have configured Netbeans to use Python (instead of Jython). 我已将Netbeans配置为使用Python(而不是Jython)。 I added a reference to C:\\Python26\\Lib\\site-packages\\PIL to the project but when I attempt this code: 我向项目添加了对C:\\ Python26 \\ Lib \\ site-packages \\ PIL的引用,但是当我尝试此代码时:

import Image, ImageDraw

img = Image.new("RGB", (100,150),(255,255,255))

I get the following error: 我收到以下错误:

ImportError: The _imaging C module is not installed ImportError:未安装_imaging C模块

The _imaging.pyd file exists and is in the right directory. _imaging.pyd文件存在并且位于正确的目录中。 Furthermore, Python (from the command line) can load PIL and Image and execute the code that I posted above successfully. 此外,Python(从命令行)可以加载PIL和Image并成功执行我上面发布的代码。 Can anyone enlighten me as to what I am doing wrong? 谁能启发我我做错了什么? Thank you! 谢谢!

Solved. 解决了。 Project was incorrectly using Jython instead of Python. 项目错误地使用了Jython而不是Python。 Although I configured Python as the default Python instance in the main Netbeans settings, that change didn't propagate to my project. 尽管我在主要的Netbeans设置中将Python配置为默认的Python实例,但是该更改并未传播到我的项目中。 Setting it in the projects properties fixed it. 在项目属性中设置它可以修复它。 Jython is known to have issues with PIL. Jython已知与PIL有关。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何卸载python 2.6.5并在ubuntu 10.04中安装最新版本(2.7.3) - How can I uninstall python 2.6.5 and install the newest version(2.7.3) in ubuntu 10.04 我可以在Python 2.6.5中使用unllode-ready替换urllib.quote和urllib.unquote吗? - Is there a unicode-ready substitute I can use for urllib.quote and urllib.unquote in Python 2.6.5? 如何使用自省功能让Python告诉我更多有关PIL ImagingCore对象的信息? - How can I use introspection to get Python to tell me more about PIL ImagingCore objects? 如何在Python中使用PIL使用变量而不是路径来打开图像文件? - How can I use a variable instead of a path to open an image file using PIL in Python? 如何获得 Python Pillow (PIL) 版本? - How to get Python Pillow (PIL) version? 如何卸载 python 2.7 的 PIL 并改用 Pillow? - How do I uninstall PIL for python 2.7 and use Pillow instead? 如何使用 Python PIL 将图像保存到特定目录? - How do I use Python PIL to save an image to a particular directory? 如何在Django中加载用于PIL的静态字体文件? - How can I load a static font file for use with PIL in Django? Python:如何在PIL.ImageGrab中获取屏幕截图数据? - Python:How can I get screenshot data in PIL.ImageGrab? 如何使用有两种颜色的 python PIL 创建图像? - How Can I create an image with python PIL where there are two colors?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM