• 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

  • 相关阅读:
    IDEA启动tomcat乱码
    RowKey设计之单调递增行键/时序数据
    ES入门REST API
    WebSocket-java实践
    Linux(CentOS 7)安装测试mysql5.6服务
    Linux(CentOS 7)安装测试svn服务
    Node.js安装及环境配置之Windows篇---完美,win7已测
    Java配置----JDK开发环境搭建及环境变量配置
    手把手教新手小白在window把自己的项目上传到github
    github常见操作和常见错误!错误提示:fatal: remote origin already exist
  • 原文地址:https://www.cnblogs.com/reblue520/p/14140585.html
Copyright © 2020-2023  润新知