【问题标题】:OSError: No wkhtmltoimage executable found: "b''"OSError:找不到 wkhtmltoimage 可执行文件:“b''”
【发布时间】:2020-11-05 22:28:12
【问题描述】:

代码如下

import imgkit
imgkit.from_url('http://google.com', 'out.jpg')

FileNotFoundError Traceback(最近一次调用最后一次)

我已经安装了!pip install imgkit

https://pypi.org/project/imgkit/

来自评论区

import  wkhtmltopdf 
import   imgkit
imgkit.from_url('http://google.com', 'out.jpg')

我遇到了主要错误

【问题讨论】:

  • 你也需要安装wkhtmltopdf
  • @ZWang 我也安装了,
  • 无需导入wkhtmltopdf,安装即可。您使用的是哪个系统(Windows/Linux)以及您使用的是哪个版本的 python?

标签: python


【解决方案1】:

适用于 Windows 系统的解决方案。将路径替换为您自己的可执行文件路径。

con = imgkit.config(wkhtmltoimage='C:\\Program Files\\wkhtmltopdf\\bin\\wkhtmltoimage.exe')
imgkit.from_string(myString, 'out.jpg', config=con)

from_url 函数也是如此。

【讨论】:

    猜你喜欢
    • 2017-07-14
    • 2020-09-02
    • 2019-11-28
    • 2019-11-02
    • 2013-11-20
    • 2012-07-22
    • 2017-05-07
    相关资源
    最近更新 更多