当前位置: 首页 > 知识库问答 >
问题:

部署到azure web app时引发ImportError('找不到zbar共享库')[重复]

章丰茂
2023-03-14

我有一个python项目,我正试图从我的windowspc将其部署到azure web app。它在windows本地pc上运行得非常好,但是当我在那里开发时,我在下面得到了这个错误日志

从Azure Web应用程序登录:

2021-12-12T15:13:47  Welcome, you are now connected to log-streaming service.


Starting Log Tail -n 10 of existing logs ----
/home/LogFiles/__lastCheckTime.txt  (https://barcodessecret.scm.azurewebsites.net/api/vfs/LogFiles/__lastCheckTime.txt)12/12/2021 15:13:24

/home/LogFiles/kudu/trace/046d6a19f398-24f4f7a7-d50b-4ea9-be24-c7c34e2d5366.txt  (https://barcodessecret.scm.azurewebsites.net/api/vfs/LogFiles/kudu/trace/046d6a19f398-24f4f7a7-d50b-4ea9-be24-c7c34e2d5366.txt)
2021-12-12T10:52:10    Outgoing response, type: response, statusCode: 404, statusText: NotFound

/home/LogFiles/kudu/trace/046d6a19f398-3df0f78c-d0d0-4e08-a612-9e9ad0816062.txt  (https://barcodessecret.scm.azurewebsites.net/api/vfs/LogFiles/kudu/trace/046d6a19f398-3df0f78c-d0d0-4e08-a612-9e9ad0816062.txt)
2021-12-12T11:12:10    Outgoing response, type: response, statusCode: 404, statusText: NotFound

/home/LogFiles/kudu/trace/046d6a19f398-a222a843-e436-4f93-b238-b4bc721aba7a.txt  (https://barcodessecret.scm.azurewebsites.net/api/vfs/LogFiles/kudu/trace/046d6a19f398-a222a843-e436-4f93-b238-b4bc721aba7a.txt)
2021-12-12T10:12:09  Startup Request, url: /, method: HEAD, type: request, pid: 79,1,5, ScmType: None, SCM_DO_BUILD_DURING_DEPLOYMENT: true

/home/LogFiles/kudu/trace/7a8a200c580b-f1a5986f-5cfc-4ca1-aafe-30f1230d1e60.txt  (https://barcodessecret.scm.azurewebsites.net/api/vfs/LogFiles/kudu/trace/7a8a200c580b-f1a5986f-5cfc-4ca1-aafe-30f1230d1e60.txt)
2021-12-12T15:12:10  Startup Request, url: /api/vfs/site/wwwroot/?_=1639321905938, method: GET, type: request, pid: 67,1,4, ScmType: None, SCM_DO_BUILD_DURING_DEPLOYMENT: true

/home/LogFiles/2021_12_12_10-30-0-10_default_docker.log  (https://barcodessecret.scm.azurewebsites.net/api/vfs/LogFiles/2021_12_12_10-30-0-10_default_docker.log)
2021-12-12T11:44:40.357915732Z     return prototype((fname, load_libzbar()))
2021-12-12T11:44:40.357921832Z   File "/tmp/8d9bd6318a7b507/antenv/lib/python3.8/site-packages/pyzbar/wrapper.py", line 115, in load_libzbar
2021-12-12T11:44:40.357927632Z     libzbar, dependencies = zbar_library.load()
2021-12-12T11:44:40.357933732Z   File "/tmp/8d9bd6318a7b507/antenv/lib/python3.8/site-packages/pyzbar/zbar_library.py", line 65, in load
2021-12-12T11:44:40.357940032Z     raise ImportError('Unable to find zbar shared library')
2021-12-12T11:44:40.357946132Z ImportError: Unable to find zbar shared library
2021-12-12T11:44:40.358272136Z [2021-12-12 11:44:40 +0000] [41] [INFO] Worker exiting (pid: 41)
2021-12-12T11:44:40.563733800Z [2021-12-12 11:44:40 +0000] [39] [INFO] Shutting down: Master
2021-12-12T11:44:40.563780701Z [2021-12-12 11:44:40 +0000] [39] [INFO] Reason: Worker failed to boot.


/home/LogFiles/2021_12_12_10-30-0-10_docker.log  (https://barcodessecret.scm.azurewebsites.net/api/vfs/LogFiles/2021_12_12_10-30-0-10_docker.log)
2021-12-12T11:38:17.033Z ERROR - Container barcodessecret_0_a5c0ed86 didn't respond to HTTP pings on port: 8000, failing site start. See container logs for debugging.
2021-12-12T11:38:17.108Z INFO  - Stopping site barcodessecret because it failed during startup.
2021-12-12T11:44:10.056Z INFO  - Starting container for site
2021-12-12T11:44:10.058Z INFO  - docker run -d -p 8000:8000 --name barcodessecret_0_cc711f28 -e WEBSITE_SITE_NAME=barcodessecret -e WEBSITE_AUTH_ENABLED=False -e WEBSITE_ROLE_INSTANCE_ID=0 -e WEBSITE_HOSTNAME=barcodessecret.azurewebsites.net -e WEBSITE_INSTANCE_ID=e8a25aeda9f8112c52a78edbf794ec6bc124d323fe575e4a705382f2e36592ba -e HTTP_LOGGING_ENABLED=1 appsvc/python:3.8_20210810.1
2021-12-12T11:44:14.616Z INFO  - Initiating warmup request to container barcodessecret_0_cc711f28 for site barcodessecret
2021-12-12T11:44:30.360Z INFO  - Waiting for response to warmup request for container barcodessecret_0_cc711f28. Elapsed time = 15.7438301 sec
2021-12-12T11:44:43.805Z ERROR - Container barcodessecret_0_cc711f28 for site barcodessecret has exited, failing site start
2021-12-12T11:44:43.821Z ERROR - Container barcodessecret_0_cc711f28 didn't respond to HTTP pings on port: 8000, failing site start. See container logs for debugging.
2021-12-12T11:44:43.871Z INFO  - Stopping site barcodessecret because it failed during startup.

/home/LogFiles/2021_12_12_10-30-1-36_default_docker.log  (https://barcodessecret.scm.azurewebsites.net/api/vfs/LogFiles/2021_12_12_10-30-1-36_default_docker.log)

/home/LogFiles/2021_12_12_10-30-1-36_docker.log  (https://barcodessecret.scm.azurewebsites.net/api/vfs/LogFiles/2021_12_12_10-30-1-36_docker.log)
2021-12-12T15:13:24.974Z INFO  - Starting container for site
2021-12-12T15:13:24.974Z INFO  - docker run -d -p 8000:8000 --name barcodessecret_0_73b46eaa -e WEBSITE_SITE_NAME=barcodessecret -e WEBSITE_AUTH_ENABLED=False -e WEBSITE_ROLE_INSTANCE_ID=0 -e WEBSITE_HOSTNAME=barcodessecret.azurewebsites.net -e WEBSITE_INSTANCE_ID=b48e99ae39c2631bdbfaff480078c704864fb7435737f78ac9c0af67dc0f25d5 -e HTTP_LOGGING_ENABLED=1 appsvc/python:3.8_20210810.1
2021-12-12T15:13:28.990Z INFO  - Initiating warmup request to container barcodessecret_0_73b46eaa for site barcodessecret
2021-12-12T15:13:44.398Z INFO  - Waiting for response to warmup request for container barcodessecret_0_73b46eaa. Elapsed time = 15.4079531 sec

/home/LogFiles/webssh/.log  (https://barcodessecret.scm.azurewebsites.net/api/vfs/LogFiles/webssh/.log)

Ending Log Tail of existing logs ---
Starting Live Log Stream ---

我尝试了不同的解决方案,包括将zbar-py放入我的requirments.txt文件,如下所示:

opencv-python-headless==4.5.1.48
flask
flask-sqlalchemy
flask-login
ezdxf
matplotlib
qrcode
zbar-py
pyzbar
pyzbar[scripts]

我怎样才能解决这个问题?

共有1个答案

梁浩涆
2023-03-14

尝试将libzbar0放在容器中。

或者将安装代码放在python代码的开头

!apt install libzbar0
 类似资料:
  • 我有一个项目,我正试图从我的将其部署到。它在windows,但是当我在那里开发时,我在下面得到了这个错误。 从Azure Web应用程序登录: 我尝试过不同的解决方案,包括在我的文件,如下所示: 我怎样才能解决这个问题?

  • 我正在尝试使用pyzbar 0.1。4在Docker中的Flask服务器上 该图像由我们创建,基于取自alpine的python 2.7。 通过以下方式安装ZBar 我在运行dockerfile

  • 在将一个导出的Java项目从开发机器转移到生产机器之后,我遇到了麻烦。 java项目(一个Eclipse插件)有一个我写的JNI库,它依赖于一个开源库,而开源库又依赖于Boost。我在我的SLES11机器上编译了所有东西,包括Boost,这个程序就可以工作了。 当我把程序移到另一台机器上时,我得到了一个错误: 我在同一个目录中复制了所需的库<代码>ldd libMyJNI。因此列出了20个依赖项,

  • 我在/usr/local/lib中有libcommon.so,我在程序中链接了这个库。 gcc -o测试test _ Prog . c-L/usr/local/lib-llib common . so 我也试过这个 gcc -o test test_prog.c -L/usr/local/lib -llibcommon 是给予 /usr/bin/ld: 找不到 -llibcommon.so 收集

  • 我遇到的问题,当部署laravel到共享托管css和js文件没有找到,我上传laravel文件到public_html和改变server.phpindex.php然后移动. htaccess这是在公共public_html文件夹。我使用这个方法来删除url中的公共文件夹。

  • 我部署了一个laravel应用程序到共享主机(host inger)。除了没有显示的图像,一切都很好。 我已经创建了一个符号链接的存储文件夹与我的public_html文件夹。上传的文件进入公共文件夹,但当我链接图像时,它们仍然不显示。 由于无法访问公用文件夹,我已创建指向公用html的符号链接。我需要你的帮助 我需要图像显示在浏览器上