samedi 19 mai 2018

500 Internal Server Error When Importing Python Modules

I'm new to CGI, so this problem might be silly.

I'm trying to run a Python script with CGI on my web server, but i'm encountering a problem when importing some modules.

The script works fine when writing a simple script like this one:

#!/usr/bin/python3.6
print("Content-Type: text/html\n")
print("This is a test")

And i can import most of the modules installed in the Python version of the server, but when i try to import some modules i really need for my script, i get a 500 Internal server error (these modules are tensorflow, keras and scikit-image). So this code gives a 500 error:

#!/usr/bin/python3.6
import keras
print("Content-Type: text/html\n")
print("This is a test")

I tried to print all the modules installed in the Python version with pip.get_installed_distributions() and all three modules i need, keras, tensorflow and scikit-image are installed.

My questions are:

  • How can i print the error to understand what the problem is?
  • What could be the problem considering that the packages are installed but not working?



Aucun commentaire:

Enregistrer un commentaire