作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
使用 WeasyPrint,我需要执行以下操作才能获取所需的库:
sudo apt-get install 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
我已将其添加到我的 GitHub 触发器中:
- name: Install WeasyPrint dependencies
run: |
cd /home
sudo apt-get install 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
并且当我查看构建日志时,表明它是成功的;但是,Python 应用程序仍然无法启动,并表示找不到所需的库:
OSError: no library called "cairo" was found
no library called "libcairo-2" was found
cannot load library 'libcairo.so.2': libcairo.so.2: cannot open shared
No such file or directory
cannot load library 'libcairo.2.dylib': libcairo.2.dylib: cannot open
No such file or directory
cannot load library 'libcairo-2.dll': libcairo-2.dll: cannot open
No such file or directory
我尝试做 what another user did (看起来成功了),只需通过 SSH 登录即可直接安装它,但是当我尝试这样做时,apt-get 会抛出 404 错误,例如:
(antenv) root@13f25a3adfa1:/tmp/8d947bb726491c3# apt-get install libcairo2
Reading package lists... Done
Building dependency tree
[. . .]
Fetched 4156 kB in 0s (4207 kB/s)
E: Failed to fetch http://security.debian.org/debian-security/pool/updates/main/libx/libx11/libx11-data_1.6.4-3+deb9u3_all.deb 404 Not Found
E: Failed to fetch http://security.debian.org/debian-security/pool/updates/main/libx/libx11/libx11-6_1.6.4-3+deb9u3_amd64.deb 404 Not Found
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
Azure 应用服务不允许您再这样做吗?我不知道下一步该尝试什么。
编辑:因此,我能够通过 SSH 连接到计算机并首先运行 apt-get update 来获取要添加的所有依赖项。但是,我仍然遇到我的 Python 应用程序仍然无法运行的问题。即使安装了库,我也看到以下错误:
2021-07-19T14:43:06.741297128Z OSError: no library called "cairo" was found
2021-07-19T14:43:06.741300828Z no library called "libcairo-2" was found
2021-07-19T14:43:06.741304429Z cannot load library 'libcairo.so.2': libcairo.so.2: cannot open shared object file: No such file or directory
2021-07-19T14:43:06.741308229Z cannot load library 'libcairo.2.dylib': libcairo.2.dylib: cannot open shared object file: No such file or directory
2021-07-19T14:43:06.741311929Z cannot load library 'libcairo-2.dll': libcairo-2.dll: cannot open shared object file: No such file or directory
最佳答案
https://learn.microsoft.com/en-us/azure/app-service/configure-language-python
如果应用设置 SCM_DO_BUILD_DURING_DEPLOYMENT 设置为 1,则应用服务的构建系统(称为 Oryx)会在您部署应用时执行以下步骤:...
我相信它可以放在requirements.txt或PRE_BUILD_COMMAND设置中
关于azure - 如何将 WeasyPrint 依赖项添加到 Azure 应用服务应用程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68412918/
我是一名优秀的程序员,十分优秀!