Use OpenCV on deployed Flask app (Heroku)

青春壹個敷衍的年華 提交于 2021-02-08 10:12:54

问题


Hello I seem to be having trouble importing opencv on my deployed flask app on Heroku!

I've referred to similar posts such as this this "ImportError: libSM.so.6: cannot open shared object file: No such file or directory " but can't seem to figure out the next steps on windows.

This is what I've done so far:
1. gone to Heroku -> App -> Settings -> Buildpacks -> added Python buildpack
2. Added a Aptfile.txt to my directory with the following packages on each line (read this somewhere not sure if it makes any sense)

libsm6 , libxrender1 ,libfontconfig1, libice6

Notes:

  • My openCV version-- opencv-python==3.4.3.18
  • I'm on windows so the sudo commands recommended in the other post answers dont work

Thanks in advance!


回答1:


Use opencv-python-headless it's out of libSM6 dependency.

pip install opencv-python-headless



回答2:


put this line in requirments.txt

opencv-python-headless==4.2.0.32



来源:https://stackoverflow.com/questions/53110120/use-opencv-on-deployed-flask-app-heroku

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!