Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 3.x PDFKit FileNotFoundError Python_Python 3.x_Macos_Python Pdfkit - Fatal编程技术网

Python 3.x PDFKit FileNotFoundError Python

Python 3.x PDFKit FileNotFoundError Python,python-3.x,macos,python-pdfkit,Python 3.x,Macos,Python Pdfkit,我正在尝试使用Python3中的pdfkit将html文件转换为PDF。我在macOS Mojave中使用PyCharm,这是我在尝试运行代码时遇到的错误: Traceback (most recent call last): File "/Users/cesarvargas/miniconda3/envs/test/lib/python3.6/site- packages/pdfkit/configuration.py", line 21, in __init__ w

我正在尝试使用Python3中的pdfkit将html文件转换为PDF。我在macOS Mojave中使用PyCharm,这是我在尝试运行代码时遇到的错误:

   Traceback (most recent call last):
   File "/Users/cesarvargas/miniconda3/envs/test/lib/python3.6/site- 
   packages/pdfkit/configuration.py", line 21, in __init__
   with open(self.wkhtmltopdf) as f:
   FileNotFoundError: [Errno 2] No such file or directory: b''
这是我正在使用的代码:

import pdfkit

if __name__ == "__main__":
    with open("test.html") as f:
        t = pdfkit.from_file(f, False)

我已经解决了错误,安装了WKHTMLtoPDF二进制文件:

更多信息请点击此处: