-1

I'm running Windows 7, and using Google Chrome as my web browser.

This is my code:

#!/usr/bin/env python
print 'content-type: text/html\n'

print """
<!DOCTYPE html>
  <html>
    <head>
      <title> sample </title>
    </head>

    <body>
"""

print 2 + 3

print """
    </body>
  </html>
"""

In Command Prompt, where python results in C:\Python27\python.exe, but according to this post I should use #!/usr/bin/env python instead.

When I try to run this .py code in my browser, the source code appears instead of just 5.

If someone would provide detailed instructions as to how to properly work this, I would be most grateful.

Thanks!

user604803
  • 33
  • 1
  • 9

1 Answers1

0

Okay. So of course it is not possible to run python directly in the browser but you can configure a local server to be able to run CGI scripts. Since you are on windows you could use something like a WAMP. Try following this tutorial https://wiki.python.org/moin/CgiScripts

hahahakebab
  • 328
  • 7
  • 22