简体   繁体   中英

How can I run the python script which contain libraries from php hosted on heroku?

I am all new to Heroku and I wanted to call the python script which contains libraries like numpy and opencv. They execute on localhost from PHP when I call them using shell_exec() or exec() function. But in Heroku, only simple python script which does not contain any library imported are executing. Whenever the libraries are imported it fails. I have set the buildpack as PHP and python.

I want that python script to be executed from PHP please help me with it!. I have searched a lot but methods are not working. They are working fine on local host.

In alternative if there is a way in which I can host the application apart from heroku where both the php and python script can be executed let me know about that also.

Create requirements.txt by using cmd pip freeze > requirements.txt in the desired folder it will define all the required libraries or do it manually in the following format:-

Flask==0.9-devdev-20120114
Jinja2==2.6
Werkzeug==0.8.2
wsgiref==0.1.2

And then deploy your app.

Let me know if it worked.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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