当前位置:首页 > 服务端 > python3.6和python3.7.10安装cairosvg模块后报错cannot load library 'libcairo.so.2': /lib64/libcairo.so.2: undefined symbol: FT_Get_Var_Design_Coordinates

python3.6和python3.7.10安装cairosvg模块后报错cannot load library 'libcairo.so.2': /lib64/libcairo.so.2: undefined symbol: FT_Get_Var_Design_Coordinates


yum install -y build-essential python3-dev python3-pip python3-setuptools python3-wheel python3-cffi libcairo2 libpango-1.0-0 libpangocairo-1.0-0 libgdk-pixbuf2.0-0 libffi-dev shared-mime-info
pip3 install python3 cairo pango gdk-pixbuf libffi
yun install cairo -y
yum install cairo-devel -y

pip3 install weasyprint
yum install freetype-devel -y

pip3 install cairosvg


# 安装 cairosvg 模块后报错的处理


[root@eus-image-design-mongo01:~]# python3
Python 3.6.8 (default, Apr  2 2020, 13:34:55)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cairosvg
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib64/python3.6/site-packages/cairosvg/__init__.py", line 26, in <module>
    from . import surface  # noqa isort:skip
  File "/usr/local/lib64/python3.6/site-packages/cairosvg/surface.py", line 9, in <module>
    import cairocffi as cairo
  File "/usr/local/lib/python3.6/site-packages/cairocffi/__init__.py", line 50, in <module>
    ('libcairo.so.2', 'libcairo.2.dylib', 'libcairo-2.dll'))
  File "/usr/local/lib/python3.6/site-packages/cairocffi/__init__.py", line 45, in dlopen
    raise OSError(error_message)  # pragma: no cover
OSError: no library called "libcairo-2" was found
cannot load library 'libcairo.so.2': libcairo.so.2: cannot open shared object file: No such file or directory
cannot load library 'libcairo.so.2': libcairo.so.2: cannot open shared object file: No such file or directory
cannot load library 'libcairo.2.dylib': libcairo.2.dylib: cannot open shared object file: No such file or directory
cannot load library 'libcairo-2.dll': libcairo-2.dll: cannot open shared object file: No such file or directory
>>> import cairosvg
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib64/python3.6/site-packages/cairosvg/__init__.py", line 26, in <module>
    from . import surface  # noqa isort:skip
  File "/usr/local/lib64/python3.6/site-packages/cairosvg/surface.py", line 9, in <module>
    import cairocffi as cairo
  File "/usr/local/lib/python3.6/site-packages/cairocffi/__init__.py", line 50, in <module>
    ('libcairo.so.2', 'libcairo.2.dylib', 'libcairo-2.dll'))
  File "/usr/local/lib/python3.6/site-packages/cairocffi/__init__.py", line 45, in dlopen
    raise OSError(error_message)  # pragma: no cover
OSError: no library called "libcairo-2" was found
cannot load library 'libcairo.so.2': /lib64/libcairo.so.2: undefined symbol: FT_Get_Var_Design_Coordinates
cannot load library 'libcairo.so.2': /lib64/libcairo.so.2: undefined symbol: FT_Get_Var_Design_Coordinates
cannot load library 'libcairo.2.dylib': libcairo.2.dylib: cannot open shared object file: No such file or directory
cannot load library 'libcairo-2.dll': libcairo-2.dll: cannot open shared object file: No such file or directory
>>> import cairosvg
>>>



参考:https://stackoverflow.com/questions/60309060/cannot-load-library-libcairo


找到如下:

[root@eus-image-design-mongo01:~]# find / -name libfreetype.so.6
/usr/lib64/libfreetype.so.6
/usr/local/lib/libfreetype.so.6
/usr/local/lab/freetype-2.5.2/objs/.libs/libfreetype.so.6
/usr/local/lab/freetype-2.5.4/lib/libfreetype.so.6
/usr/local/src/freetype-2.5.4/objs/.libs/libfreetype.so.6
find: ‘/proc/24662/task/17678’: No such file or directory
find: ‘/proc/24662/task/17679’: No such file or directory
# 解决办法
[root@eus-image-design-mongo01:~]# mv /usr/local/lib/libfreetype.so.6 /usr/local/lib/libfreetype.so.6.bak

作者:reblue520
来源链接:https://www.cnblogs.com/reblue520/p/14140585.html

版权声明:
1、Java侠(https://www.javaxia.com)以学习交流为目的,由作者投稿、网友推荐和小编整理收藏优秀的IT技术及相关内容,包括但不限于文字、图片、音频、视频、软件、程序等,其均来自互联网,本站不享有版权,版权归原作者所有。

2、本站提供的内容仅用于个人学习、研究或欣赏,以及其他非商业性或非盈利性用途,但同时应遵守著作权法及其他相关法律的规定,不得侵犯相关权利人及本网站的合法权利。
3、本网站内容原作者如不愿意在本网站刊登内容,请及时通知本站(javaclubcn@163.com),我们将第一时间核实后及时予以删除。





本文链接:https://www.javaxia.com/server/125296.html

分享给朋友:

“python3.6和python3.7.10安装cairosvg模块后报错cannot load library 'libcairo.so.2': /lib64/libcairo.so.2: undefined symbol: FT_Get_Var_Design_Coordinates” 的相关文章

pycharm安装教程,超详细2022年05月16日 21:28:02
CentOS yum 源的配置与使用2022年05月19日 19:54:27
Python 树表查找2022年05月20日 21:28:27
引用类型2022年05月21日 11:41:30
备战5月软考2022年05月23日 22:39:11
概率论快速学习02:概率公理2022年05月26日 21:02:52
项目ITP(一) 二维码2022年06月02日 23:33:27
设计模式-桥接模式2022年06月04日 20:58:35