我想在 Sikuli 中导入 PIL 为此我添加了下面的代码
import sys
sys.path.append("C:\\Python27\Lib\site-packages")
sys.path.append("C:\\Python27\Lib\site-packages\PIL")
import PIL
import Image
所以它导入了上述模块,但是当我尝试导入 ImageFont 时,它给了我以下错误:
def getmask2(self, text, mode="", fill=Image.core.fill):
File "C:\Python27\Lib\site-packages\PIL\Image.py", line 39, in __getattr__
raise ImportError("The _imaging C module is not installed")
ImportError: The _imaging C module is not installed
我能够在 Python 脚本中成功导入 PIL、Image 和 ImageFont,并且代码运行良好。
知道如何解决这个问题吗?
Sikuli IDE 使用 Jython,因此安装到本地 Python 版本的包将无法在 Sikuli IDE 中导入,并且 Jython 不支持 c 扩展,据我所知,PIL 需要哪些扩展(请参阅http://bugs.jython.org/issue1388 ).
我认为你需要使用 Java 库,也许像 ImageJ 之类的东西(参见http://fiji.sc/wiki/index.php/Jython_Scripting )
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)