Coder Social home page Coder Social logo

python-in-xampp-for-windows's Introduction

python-in-xampp-for-windows:

Run python in xampp for windows 18.09.12, 01:45 The setup takes nearly 2 min.

Assuming that you have already installed xammp in your windows PC, You can follow the below steps to run python in your localhost

STEP 1:

Download & install the latest version of python from here Download Python click on the windows installer of any version

STEP 2:

Install in any directory of your harddrive

STEP 3:

Open the directory where xammp was installed Go to apache >> conf

You'll see a file named httpd.conf Open it in any text editor & put the below codes in the end of that file

Code: AddHandler cgi-script .py ScriptInterpreterSource Registry-Strict The next step is optional

STEP 4: In same file search for When you've found it put index.py in the end It will look something like this Code: DirectoryIndex index.php index.pl index.cgi index.asp index.shtml index.html index.htm
default.php default.pl default.cgi default.asp default.shtml default.html default.htm
home.php home.pl home.cgi home.asp home.shtml home.html home.htm index.py STEP 5: That's all for editing, now restart apache from your xampp control panel

STEP 6:

Open a text editor & test python now

But wait at the beginning of your script you need to specify the path where you've installed python

In my case its C:/python27/python.exe In your case it may be different, depending up on the version you've installed python & the directory of your hard drive

PHP Code: #!D:/Python27/python.exe print "Content-Type: text/html\n" print "This is cool"
save the file as test.py in htdocs & open http://localhost/test.py If everything goes well, You'll see the text This is cool

Now, who the hell is gonna install python just to see the stupid text "This is cool" ?!

Here's the code to grab a web page w/ python

PHP Code: #!C:/Python27/python.exe print "Content-Type: text/html\n" import urllib2 response = urllib2.urlopen('http://python.org/') html = response.read() print html
LOL


Ref# http://coding-talk.com/forum/main-forums/coding-forum/13986-run-python-in-xampp-for-windows

python-in-xampp-for-windows's People

Contributors

matinict avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.