How to run python in shared cPanel Hosting

14 Mar

Here is how a Python script can be executed on our shared hosting servers.

1. Upload the .py file into a folder
2. Create an .htaccess file into the same folder and include the following line: AddHandler cgi-script .py
3. Edit the .py file(s) by adding “#!/usr/bin/python” in the first line
4. The permissions for .py file(s) should be 755 And you’re done – you can now successfully execute Python.

Thats it!