我是Python的新手,在学习imgkit (PI模块)时,我遇到了这个错误,这对于一个简单的代码来说是意想不到的。下面是代码
import imgkit
imgkit.from_url('https://www.google.co.in/','fs.jpg')我得到的错误是
Traceback (most recent call last):
File "G:\python\lib\site-packages\imgkit-0.1.8-py3.6.egg\imgkit\config.py", line 30, in __init__
with open(self.wkhtmltoimage):
FileNotFoundError: [Errno 2] No such file or directory: b''
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\ALEXANDER\Desktop\def img.py", line 3, in <module>
imgkit.from_url('https://www.google.co.in/','fs.jpg')
File "G:\python\lib\site-packages\imgkit-0.1.8-py3.6.egg\imgkit\api.py", line 20, in from_url
rtn = IMGKit(url, 'url', options=options, toc=toc, cover=cover, config=config, cover_first=cover_first)
File "G:\python\lib\site-packages\imgkit-0.1.8-py3.6.egg\imgkit\imgkit.py", line 34, in __init__
self.config = Config() if not config else config
File "G:\python\lib\site-packages\imgkit-0.1.8-py3.6.egg\imgkit\config.py", line 36, in __init__
'http://wkhtmltopdf.org\n'.format(self.wkhtmltoimage))
OSError: No wkhtmltoimage executable found: "b''"
If this file exists please check that this process can read it. Otherwise please install wkhtmltopdf - http://wkhtmltopdf.org谁能告诉我我做错了什么?
发布于 2019-03-14 16:01:03
在windows系统上安装wkhtmltopdf后,您需要执行以下操作:
path_wkthmltoimage = r'C:\Program Files\wkhtmltopdf\bin\wkhtmltoimage.exe'
config = imgkit.config(wkhtmltoimage=path_wkthmltoimage)
imgkit.from_file('table.html', 'table.jpg',config=config)发布于 2018-04-20 23:29:20
尝试:brew install caskroom/cask/wkhtmltopdf
发布于 2017-11-14 03:16:07
看起来你需要安装wkhtmltopdf。为此,请运行pip install wkhtmltopdf
https://stackoverflow.com/questions/47271419
复制相似问题