OSError:无法加载库'gobject-2.0':错误0x7e

问题描述

我按照Installing weasyprint(Django项目)的说明安装了软件包 weasyprint 。 我的系统:win 10.我已经安装了 gtk3 ,并且它存在于我的 PATH

PAYH gtk3

import weasyprint
...
@staff_member_required
def order_admin_pdf(request,order_id):
    # Получаем заказ по ID:
    order = get_object_or_404(Order,id=order_id)
    # Передаем объект в функцию render_to через генерацию шаблона pdf.html HTML в виде строки:
    html = render_to_string('shop/orders/order_admin_pdf.html',{'order': order})
    # Создаем объект овтета с типом содержимого application/pdf и заголовком Content-disposition:
    response = HttpResponse(content_type='application/pdf')
    response['Content-disposition'] = 'filename=order_{}.pdf"'.format(order.id)
    # Вызов метода weasyprint для получения PDF документа:
    weasyprint.HTML(string=html).write_pdf(response,stylesheets=[weasyprint.CSS(
                                               settings.STATIC_ROOT + 'css/pdf.css')])
    return response

OSError:无法加载库'gobject-2.0':错误0x7e。此外,ctypes.util.find_library()未能找到名为“ gobject-2.0”的库

解决方法

我感到绝望,决定安装库gtk2 C:\Program Files (x86)\GTK2\lib\,并在PATH列表中指定第一个库。确实有效...但是我的操作系统-赢得10 x64。我不知道为什么库GTK3拒绝工作。