windows11
Django 4.0
IDE:vscode1.70.1
pdfkit==1.0.0
django-wkhtmltopdf==3.4.0
将html以pdf形式出力
File "D:\PycharmProjects\env\lib\site-packages\pdfkit\api.py", line 72, in from_string
r = PDFKit(input, 'string', options=options, toc=toc, cover=cover, css=css,
File "D:\PycharmProjects\env\lib\site-packages\pdfkit\pdfkit.py", line 45, in __init__
self.configuration = (Configuration() if configuration is None
File "D:\PycharmProjects\env\lib\site-packages\pdfkit\configuration.py", line 38, in __init__
raise IOError('No wkhtmltopdf executable found: "%s"\n'
OSError: No wkhtmltopdf executable found: "b''"
If this file exists please check that this process can read it or
you can pass path to it manually in method call, check README.
Otherwise please install wkhtmltopdf -
https://github.com/JazzCore/python-pdfkit/wiki/Installing-wkhtmltopdf
vscode左下角,变更齿轮 > settings > 搜索【env】> terminal 下找到windows
选择【edit in settings.json】
※Mac:terminal.integrated.env.osx
settings.json编辑,若需加多个path,用【;】分号分隔
配置后需要重启虚拟环境,若不行,则重启vscode
"terminal.integrated.env.windows": {
"path":"D:\\Program Files\\wkhtmltopdf\\bin"
},
若在vscode终端有其他命令不能执行,也可尝试此方法,配置环境量
#No wkhtmltopdf executable found
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。