How to run a python script (with modules)?

Operating System & Version
linux 2.6.32-954.3.5.lve1.4.77.el6.x86_64
cPanel & WHM Version
86.0 (build 21)

sgfanega

Registered
Jun 30, 2020
1
0
0
US
cPanel Access Level
Website Owner
I'm using Namecheap's cPanel, and their support is terrible.

I have a Laravel application that executes a python script that gives me the data I need.

Currently, I'm using a a simple
PHP:
$result = shell_exec("python filepath arg1 arg2 arg 3");
.

I changed the python interpreter to the correct location, but the server doesn't have the correct modules to run the file.

I was suggested to create a Python Web App, but I don't think that'll solve what I need, and that's just to run the python file and take the output of it.

Does anyone have a better way of executing a python script(with modules) and take it's output?
 

cPanelLauren

Product Owner
Staff member
Nov 14, 2017
13,296
1,262
313
Houston