Python pdfkit找不到wkhtmltopdf可执行文件

时间:2017-01-13 09:39:26

标签: python-2.7 wkhtmltopdf pdfkit

几个月前我创建了一个将URL转换为PDF文件的小脚本,今天早上我尝试转换另一个链接,但是我从py提示符中得到了这个错误:

File "<stdin>", line 1, in <module>
File "C:\Python27\lib\site-packages\pdfkit\api.py", line 24, in from_url
configuration=configuration, cover_first=cover_first)
File "C:\Python27\lib\site-packages\pdfkit\pdfkit.py", line 42, in __init__
self.configuration = (Configuration() if configuration is None
File "C:\Python27\lib\site-packages\pdfkit\configuration.py", line 27, in __init__
'https://github.com/JazzCore/python-pdfkit/wiki/Installing-wkhtmltopdf' % self.wkhtmltopdf)
IOError: No wkhtmltopdf executable found: ""
If this file exists please check that this process can read it. Otherwise please install wkhtmltopdf - 
https://github.com/JazzCore/python-pdfkit/wiki/Installing-wkhtmltopdf

我已经google了很多但仍无法找到解决方案。有人可以帮帮我吗?

1 个答案:

答案 0 :(得分:1)

我找到了解决方案,我不知道为什么但是python正在取代我的环境路径&#34; C:\ Program Files \ wkhtmltopdf \ bin&#34;使用&#34; C:\ Program Files \ wkhtmltopdin&#34;因为&#34; \ b&#34;所以我刚刚更换了#34; \ b&#34;用&#34; / b&#34;并解决了。