Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: ‘module’ object has no attribute ‘ANTIALIAS_FAST’ #7

Open
dounai1306 opened this issue Feb 7, 2017 · 0 comments

Comments

@dounai1306
Copy link
Owner

dounai1306 commented Feb 7, 2017

原先是因为在windows下,缺少一个dll文件,安装GTK+即可解决

官方文档:http://cairosvg.org/
官方文档示例很简单,pip install cairosvg

>>> import cairosvg
>>> cairosvg.svg2pdf(url=’image.svg’, write_to=’image.pdf’)

成功

在pycharm下撸了代码:

import cairosvg
cairosvg.svg2png(url=image.svg’, write_to=image.png’)

错误信息:AttributeError: ‘module’ object has no attribute ‘ANTIALIAS_FAST’

解决方案:
1、Install Python version >=3.4 (and pip, which seems to be included in the Windows installer)
2、If you want, set up virtualenv(这步在实际中忽略)
3、Install lxml. pip install lxml doesn’t seem to be working for me on Windows, so I used the unofficial binary from http://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml
4、Install cairosvg: pip install cairosvg
5、Install cairocffi: pip install cairocffi==0.6(不知道为啥,安装最新版本报错,只能安装此版本)
At this point it might be worth trying to run the generate-xml script and seeing if it works…(到这步的时候,依然是有错误)
…If not, install the GTK+ Runtime (as noted in the cairocffi docs)(执行完第七步,重启pycharm,终于可以正常运行)
原先是因为在windows下,缺少一个dll文件,安装GTK+即可解决

解决方案参考:nathanielw/Material-Icons-for-Pencil#2
GTK :https://pythonhosted.org/cairocffi/overview.html#installing-cairo-on-windows

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant