I want install Python with Wamp or Appserv on windows, how to install ? can it run together ?
You can run python application on localhost. At first, install Python and then you have 2 methods:
1) Open CMD
2) run: cd path/to/project/
3) run: python -m http.server 8080
4) Open http://127.0.0.1/
and you will be in your project ! That's simple
__
1) open ...wamp\bin\apache\apacheXXXX\conf\httpd.conf
, then search for Options Indexes FollowSymLinks
and add in the end: ExecCGI
(or Includes ExecCGI
)
2) Find & ensure that LoadModule cgi_module is NOT commented.
3) Search #AddHandler cgi-script .cgi
and remove #
. Then on next line add this:
AddHandler cgi-script .py
4) Find the line:
DirectoryIndex index.php index.php3 index.html index.htm
and add in the end of them: index.cgi index.py
Now, Restart Apache.
5) create a sample.py, with content (just change C:\Python34 path with your installation path):
#!C:\Python34\python\python.exe
print("Content-type: text/html\n\n");
print("helloooooo")
#####---> for python Version 2.x, use: print "helloooooo"
p.s. NOTES: (A) To avoid problems, dont install PYTHON in a path, wherein any "folder name" contains a space. (B) There should not be a space between the start of line and print(..
6) Restart WAMP.
THAT's all!! Open http://localhost/sample.py
!!
p.s.note, in come cases, while using .htaccess [inside .py directory], you might need to insert these lines in .htaccess:
Options +ExecCGI
AddHandler cgi-script .py