简体   繁体   English

如何在Docker(Azure Web App)中为Python导入cv2?

[英]How to import cv2 for Python in a docker (Azure Web App)?

The error that is displayed is: 显示的错误是:

...
2019-08-16T11:48:08.491189686Z     return util.import_app(self.app_uri)
2019-08-16T11:48:08.491192986Z   File "/usr/local/lib/python3.6/site-packages/gunicorn/util.py", line 350, in import_app
2019-08-16T11:48:08.491196286Z     __import__(module)
2019-08-16T11:48:08.491199486Z   File "/home/site/wwwroot/Webapp/main.py", line 12, in 
2019-08-16T11:48:08.491203086Z     import cv2
2019-08-16T11:48:08.491206386Z   File "/home/site/wwwroot/antenv3.6/lib/python3.6/site-packages/cv2/__init__.py", line 3, in 
2019-08-16T11:48:08.491209886Z     from .cv2 import *
2019-08-16T11:48:08.491213086Z ImportError: libgthread-2.0.so.0: cannot open shared object file: No such file or directory
2019-08-16T11:48:08.497759820Z [2019-08-16 11:48:08 +0000] [36] [INFO] Worker exiting (pid: 36)
2019-08-16T11:48:08.652109211Z [2019-08-16 11:48:08 +0000] [33] [INFO] Shutting down: Master
2019-08-16T11:48:08.652493413Z [2019-08-16 11:48:08 +0000] [33] [INFO] Reason: Worker failed to boot.

I found resources online that say I need to run ( ImportError: libSM.so.6: cannot open shared object file: No such file or directory ) 我在网上找到说我需要运行的资源( ImportError:libSM.so.6:无法打开共享库文件:没有这样的文件或目录

But on the Azure Platform, once the deployment isnt running, it isnt possible to connect to the web SSH. 但是在Azure平台上,一旦部署未运行,就无法连接到Web SSH。 So how do I fix this issue of importing cv2? 那么,如何解决导入cv2的问题? Web SSH尝试

I think you need the dependency package to proper install and also it needs the scikit-image==0.15.0 我认为您需要依赖包才能正确安装,也需要scikit-image == 0.15.0

pip install opencv-contrib-python pip安装opencv-contrib-python

pip install opencv-python pip安装opencv-python

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM