安装El Capitan(OSX 10.11)后无法运行WeasyPrint [英] Trouble running WeasyPrint after installing El Capitan (OSX 10.11)

查看:121
本文介绍了安装El Capitan(OSX 10.11)后无法运行WeasyPrint的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近将Mac上的操作系统更新为El Capitan,此后一直遇到尝试运行WeasyPrint的问题.我已经更新了macports,已卸载并重新安装了所有macport依赖项.我还通过pip卸载并重新安装了WeasyPrint,没有问题,但仍然无法运行.我的〜/.profile中也有导出DYLD_FALLBACK_LIBRARY_PATH ="/opt/local/lib",这有助于解决导入错误,并允许在安装El Capitan之前运行WeasyPrint. 当我在终端上输入weasyprint --help时,出现以下输出/错误:

I recently updated my OS on my mac to El Capitan and since then have been running into issues trying to run WeasyPrint. I have updated macports, uninstalled and reinstalled all of the macport dependencies. I've also uninstalled and reinstalled WeasyPrint via pip with no issues, but still it doesn't run. I also have the export DYLD_FALLBACK_LIBRARY_PATH="/opt/local/lib" in my ~/.profile which helped solve the import errors and allowed WeasyPrint to run before I had El Capitan installed. When i type weasyprint --help into the terminal i get the following output/error:

File "main.py", line 14, in <module>
    import nextline_webapp.quotes                   # pylint: disable=unused-import
  File "/Users/joshsacks/NextLine/nextline_webapp/quotes.py", line 8, in <module>
    from flask_weasyprint import HTML, render_pdf
  File "/Library/Python/2.7/site-packages/flask_weasyprint/__init__.py", line 13, in <module>
    import weasyprint
  File "/Library/Python/2.7/site-packages/weasyprint/__init__.py", line 336, in <module>
    from .css import PARSER, preprocess_stylesheet
  File "/Library/Python/2.7/site-packages/weasyprint/css/__init__.py", line 30, in <module>
    from . import computed_values
  File "/Library/Python/2.7/site-packages/weasyprint/css/computed_values.py", line 18, in <module>
    from .. import text
  File "/Library/Python/2.7/site-packages/weasyprint/text.py", line 18, in <module>
    import cairocffi as cairo
  File "/Library/Python/2.7/site-packages/cairocffi/__init__.py", line 46, in <module>
    cairo = dlopen(ffi, 'cairo', 'cairo-2')
  File "/Library/Python/2.7/site-packages/cairocffi/__init__.py", line 43, in dlopen
    raise OSError("dlopen() failed to load a library: %s" % ' / '.join(names))
OSError: dlopen() failed to load a library: cairo / cairo-2

这看起来像是路径问题,但我已经尝试了所有我能想到的东西.有什么建议吗?

It looks like a path problem, but I've tried everything i can think of. Any suggestions?

推荐答案

好,所以我找到了解决方案(无需更改任何原始的weasyprint或cairocffi文件).显然,OS X 10.11引入了SIP,该SIP禁用了DYLD路径变量的使用.为了解决这个问题,我禁用了SIP.这样做的说明是

Ok so I found a solution (without changing any of the original weasyprint or cairocffi files). Apparently OS X 10.11 introduces SIP which disables the use of DYLD path variables. To get around this I disabled SIP. The instructions to do so are here. Basically hold command + r when booting up. Click utilities at the top and go into the terminal. type in csrutil disable then reboot and that should fix it.

这篇关于安装El Capitan(OSX 10.11)后无法运行WeasyPrint的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆