Unable to run Python on a hosted server

Hello everyone! :wave:

I have been coding in Python for a while, and now want to be able to run my python scripts on my server.

I now have access to the SSH, and managed to run some simple python programs (that I have stored in the cgi-bin folder).

I installed some Python 3 packages using the console, and when I run my program from the console like this:

 python3 test.py

the libraries that I’ve installed work great, but when I run it from an URL, the libraries aren’t recognized.

I firstly thought that maybe my server was executing the program using Python 2, but I specified the Python 3 location and I checked that the program was running in Python 3.

I also tried to print the installed libraries using print(help("modules")), but the request module (the one that I want to use) doesn’t appear…

What can I do to run make my python program recognize the library when I run it from an URL?

Here’s my example program:


 #!/usr/bin/python3

print("Content-type: text/html\n\n")

import requests

print("hello world")

Thank you very much,
Markus