robertzhangwenjie/gitbook2pdf

运行报错

Opened this issue · 2 comments

D:\Code\PythonProject\gitbook2pdf\venv\Scripts\python.exe D:\Code\PythonProject\gitbook2pdf\gitbook.py 
Traceback (most recent call last):
  File "D:\Code\PythonProject\gitbook2pdf\gitbook.py", line 2, in <module>
    from gitbook2pdf import Gitbook2PDF
  File "D:\Code\PythonProject\gitbook2pdf\gitbook2pdf\__init__.py", line 1, in <module>
    from .gitbook2pdf import Gitbook2PDF
  File "D:\Code\PythonProject\gitbook2pdf\gitbook2pdf\gitbook2pdf.py", line 12, in <module>
    import weasyprint
  File "D:\Code\PythonProject\gitbook2pdf\venv\Lib\site-packages\weasyprint\__init__.py", line 325, in <module>
    from .css import preprocess_stylesheet  # noqa isort:skip
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Code\PythonProject\gitbook2pdf\venv\Lib\site-packages\weasyprint\css\__init__.py", line 27, in <module>
    from . import computed_values, counters, media_queries
  File "D:\Code\PythonProject\gitbook2pdf\venv\Lib\site-packages\weasyprint\css\computed_values.py", line 16, in <module>
    from ..text.ffi import ffi, pango, units_to_double
  File "D:\Code\PythonProject\gitbook2pdf\venv\Lib\site-packages\weasyprint\text\ffi.py", line 403, in <module>
    gobject = _dlopen(
              ^^^^^^^^
  File "D:\Code\PythonProject\gitbook2pdf\venv\Lib\site-packages\weasyprint\text\ffi.py", line 390, in _dlopen
    return ffi.dlopen(names[0])  # pragma: no cover
           ^^^^^^^^^^^^^^^^^^^^
  File "D:\Code\PythonProject\gitbook2pdf\venv\Lib\site-packages\cffi\api.py", line 150, in dlopen
    lib, function_cache = _make_ffi_library(self, name, flags)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Code\PythonProject\gitbook2pdf\venv\Lib\site-packages\cffi\api.py", line 832, in _make_ffi_library
    backendlib = _load_backend_lib(backend, libname, flags)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Code\PythonProject\gitbook2pdf\venv\Lib\site-packages\cffi\api.py", line 827, in _load_backend_lib
    raise OSError(msg)
OSError: cannot load library 'gobject-2.0-0': error 0x7e.  Additionally, ctypes.util.find_library() did not manage to locate a library called 'gobject-2.0-0'

进程已结束,退出代码1

环境: Windows 11 + Pycharm + Python 3.11

操作:
将参数改了,运行出错

if __name__ == '__main__':
    # url = sys.argv[1]
    # fname = sys.argv[2]
    url = 'https://aceld.gitbooks.io/libevent/'
    fname = 'libevent.pdf'
    Gitbook2PDF(url,fname).run()

windows 平台目前我没有验证过,你这边可以试下使用我提供的镜像的方式