Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

install python modules in a web server hosted by hostgator

Tags:

python

php

i'm working on a project using python and php, now when i run python on my mac terminal it runs perfect but when i try execute a command from my php on my localhost or live server it keep giving me this error below...can some one with me some tips on how to install python modules on a server using ssh or any other way.. thank you in advance!

 Traceback (most recent call last):
 File "demo.py", line 7, in <module>
import requests
ImportError: No module named requests

 here is my php code...
 $data = "hello world";
 $cmd = "/usr/bin/python demo.py '$data' 2>&1";
 $response = shell_exec($cmd);
like image 443
Shender Ramos Avatar asked Feb 04 '23 19:02

Shender Ramos


1 Answers

According to the official support article from Hostgator, requests module is not currently installed on all Linux servers. That is why import requests doesn't work. Installing modules by users is not allowed on Hostgator shared servers, so we could not use modules not installed.

Reference: http://support.hostgator.com/articles/hosting-guide/hardware-software/python-modules

like image 154
Ethan Avatar answered Feb 07 '23 19:02

Ethan