docker chromium/chrome: error while loading shared libraries: libXcursor.so.2: cannot open shared object file: No such file or directory

在运行 pyppeteer 的时候,因为依赖浏览器,出现上述情况。

解决办法:

一般我们在Linux下执行某些外部程序的时候可能会提示找不到共享库的错误。原因一般有两个, 一个是操作系统里确实没有包含该共享库(lib*.so.*文件)或者共享库版本不对, 遇到这种情况那就去网上下载并安装上即可. 

解决 Pyppeteer在docker中的依赖:

1. 更新并安装:

apt-get install -yq gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils

2. 做好字体库安装或者映射,否则容易出现,页面字体小方块的情况

ln -s 字体库文件 /usr/share/fonts/custom

参考:https://www.cnblogs.com/Anker/p/3209876.html

参考:https://github.com/macacajs/macaca-puppeteer-docker/blob/master/Dockerfile

猜你喜欢

转载自www.cnblogs.com/spaceapp/p/11957859.html