关于python:AttributeError:模块’pytesseract’没有属性’image_to_string’

老村长是酒鬼 2020-11-08 09:25:08
我是新手小白,请各位大佬帮忙看下是啥问题,感谢感谢!
如图所示,代码运行后提示这个
AttributeError: module 'pytesseract' has no attribute 'image_to_string'

...全文
1143 2 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
老村长是酒鬼 2020-11-09
  • 打赏
  • 举报
回复 3
引用 1 楼 crifan的回复:
用google搜:
module 'pytesseract' has no attribute 'image_to_string'
找到了
python - AttributeError: module 'pytesseract' has no attribute 'image_to_string' - Stack Overflow

想到了:可能是你 测试文件名 和 库文件 同名导致的。
仔细一看你截图,果然是 当前目录下 有个 pytesseract.py,和库文件 同名了

解决办法:
确保你测试的文件 不要和 被测的库 同名
此处即:
把(被测文件pytesseract2.py所在同目录中的)pytesseract.py 改为 比如 pytesseractTest.py


详见:
测试文件名和库同名 · Python新手小白常见错误和问题
非常感谢哈!!!
crifan 2020-11-09
  • 打赏
  • 举报
回复
用google搜:
module 'pytesseract' has no attribute 'image_to_string'
找到了
python - AttributeError: module 'pytesseract' has no attribute 'image_to_string' - Stack Overflow

想到了:可能是你 测试文件名 和 库文件 同名导致的。
仔细一看你截图,果然是 当前目录下 有个 pytesseract.py,和库文件 同名了

解决办法:
确保你测试的文件 不要和 被测的库 同名
此处即:
把(被测文件pytesseract2.py所在同目录中的)pytesseract.py 改为 比如 pytesseractTest.py


详见:
测试文件名和库同名 · Python新手小白常见错误和问题

37,744

社区成员

发帖
与我相关
我的任务
社区描述
JavaScript,VBScript,AngleScript,ActionScript,Shell,Perl,Ruby,Lua,Tcl,Scala,MaxScript 等脚本语言交流。
社区管理员
  • 脚本语言(Perl/Python)社区
  • WuKongSecurity@BOB
加入社区
  • 近7日
  • 近30日
  • 至今

试试用AI创作助手写篇文章吧