• python3.6安装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 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

  • 相关阅读:
    《c++primer》笔记 第3章 字符串、向量和数组
    如何下载Jason2测高数据
    《c++primer》笔记 第2章 变量和基本类型
    《c++primer》笔记 第1章 开始
    VMware打开vmx文件无响应
    Qt5.6.0连接SQL Server 2008
    Qt5.6.0(32位)编译SQLServer驱动(ODBC)(vs2013)
    Qt中操作数据库例子-插入数据
    《UNIX网络编程卷1》第一例及问题
    UVa 1225 Digit Counting
  • 原文地址:https://www.cnblogs.com/reblue520/p/14140585.html
Copyright © 2020-2023  润新知