Flask,未找到

2024-09-29 19:18:26 发布

您现在位置:Python中文网/ 问答频道 /正文

我在docker文件中添加了以下行:

RUN apk update
RUN apk --no-cache add curl
# Install wkhtmltopdf
RUN curl -L#o wk.tar.xz https://downloads.wkhtmltopdf.org/0.12/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz \
    && tar xf wk.tar.xz \
    && cp wkhtmltox/bin/wkhtmltopdf /usr/bin \
    && cp wkhtmltox/bin/wkhtmltoimage /usr/bin \
    && rm wk.tar.xz \
    && rm -r wkhtmltox

在我的要求中,我有:

pdfkit==0.6.1

但是当我尝试从cvs文件生成pdf时,我得到了一个错误:FileNotFoundError: [Errno 2] No such file or directory: '/usr/bin/wkhtmltopdf': '/usr/bin/wkhtmltopdf'

当我打开容器API并转到/usr/bin文件夹时,我拥有所有文件(/usr/bin/wkhtmltopdf):

enter image description here

我的代码:

import pdfkit


 with open('test.pdf', 'w') as f:
                pdfkit.from_file('test.csv',
                                 f.name)

为什么我会出错


Tags: 文件rmrunbinpdfusrtarcurl

热门问题