cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Go to solution

Python Question

I have a python script that needs to run in 2.7 or higher and has some packages. I have been able to install and call it in SSH but I can't figure out how to call it from a PHP script. If I call

escapeshellcmd('python predict.py');

then it still runs 2.6.6, the same command in SSH calls my 2.7. I have also tried installing python 3.7 and the same thing happens. If I call 

escapeshellcmd('python3 predict.py');

 then the script does not run, the interpreter can not be found.

 

I have the "Launch - Business Hosting" with CPanel.

1 REPLY 1
Resolver I
Solution

Re: Python Question

You need to change the default python shell.

It will be different depending on which OS you are running.

See the below link on some ideas of how to do that.

https://linuxize.com/post/how-to-install-python-3-on-centos-7

If you are not running CENTOS, then find a tutorial on your OS.