入住 CI 中国社区 登录
CodeIgniter 中国开发者社区 返回首页

rosemarry的个人空间 https://codeigniter.org.cn/forums/?39678 [收藏] [复制] [分享] [RSS]

日志

转载:“pydev python eclipse PIL 提示Unresolved import: Image”

已有 1141 次阅读2018-3-19 15:57 |个人分类:python

近期想用PIL做一个图片对比的功能

[python] view plain copy
  1. from PIL import Image  


互相学习android自动化测试,请关注我的微博:weibo.com/ganchaojiang 
上面这个语句,发现PIL可以在python shell和IDE里面都可以使用,放到pydev里面,eclipse就一直提示Unresolved import: Image 

最后还是stackoverflow给力,摘出原话:

I've found two different ways to fix this:

  1. Go to Preferences -> PyDev -> Interpreter - Python -> Forced Builtins, click "New..." and enter "PIL" (without the quotes). Click OK twice and restart Eclipse.

  2. Change your import statement to "import Image" instead of "from PIL import Image".

翻译一下:

方法2种,请使用第一种:

       打开eclipse->window->Pydev->interpreter python->Forced Builtins->New->输入PIL->Apply-> OK    

       错误提示就消失了,再输入import ,然后输入P,alt+/提示一下,看看是否有PIL提示,如有,代表已ok


路过

雷人

握手

鲜花

鸡蛋

评论 (0 个评论)

facelist doodle 涂鸦板

您需要登录后才可以评论 登录 | 入住 CI 中国社区