#!/usr/bin/python3

print('Content-type: text/plain')
# prints an empty line, to end the headers

print('Hello, world!')

I'M trying to get the above python cgi output to load in my web browser but the browser is just displaying the code it's self. My apache program is working because I just tried the phpinfo function and it worked just fine. I'M getting this code from a book and it's actually showing #!/usr/bin/env python but I decided to use what I got with the which command "which python3" -> /usr/bin/python3

Sorry o didnt understand you'r using apache to create a web server and you have a index.py ?
If yes try lighttpd server that have python suport and is easy to config.
If not explain me

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.