Posts Tagged ‘windows’

[Tutorial] install Apache + MySQL + Python on Windows

Friday, June 27th, 2014

OS version: Windows 7 64-bit Service Pack 1
last revision: 2014-06-27
here are the instructions:

# download & install XAMPP (you only can get 32-bit version for windows) (another choice)

# install python 2.7.x (choose 32-bit, Because the Apache in XAMPP is 32-bit version)
(why not python 3.x? don’t ask me, google the question by yourself.)

# check python bit-version (run the following script in Python)
import struct; print( 8 * struct.calcsize("P"))
(should print out ‘32′)

# check python version (run the following script in Python)
import sys; print (sys.version)
(print out ‘2.7.7′ in this moment)

# download mod_wsgi (a bride for Apache and Python)
Choose a 32-bit version zipped file (Because the Apache in XAMPP is 32-bit version)
Then unzip it to get a file.
or you can get it directly from here(I upload my file to google drive.)

# copy to the XAMPP installed path
i.e. if you install XAMPP in the path “D:\XAMPP”
then copy to the path: “D:\XAMPP\apache\modules\”

# add load wsgi module script in Apache configuration (httpd.conf)
LoadModule wsgi_module modules/

that’s all.
You can launch Apache & MySQL in XAMPP now.

good luck! ;-)

[IMPORT!!] the Apache bit-version must be matched with the Python bit-version, or you will get error while Apache trying to launch. They must be both 64-bit version or both 32-bit version.

================== extra ==================
# install Pydev plugin for Eclipse
1. select “Help” on top toolbar in Eclipse
2. select “install new software”
3. add a new site named Pydev , Location =
4. select “Windows” on top toolbar in Eclipse
5. Choose PyDev > Interpreters > Python Interpreter
6. add a new interpreter path: D:\Python27\python.exe

# install pip
1. visit “” and download it
2. then enter command line, type “python”
3. add the pip directory path(i.e. D:\Python27\Scripts\) in “PATH” variable (don’t ask me what is “PATH”…)
(if it shows up an error when you type “pip” in command line mode. you need to exit command line mode and reopen it to make pip script activated.)

# install virtualenv (virtualenv is a tool to create isolated Python environments. see here)
pip install virtualenv

# install MySQL Python connector(a bridge for Python and MySQL)
go to MySQL official download page
choose Microsoft Windows platform
download the MSI installer for python 2.7 and install it

# install Django (a python framework, support wsgi)
pip install django

# install BeautifulSoup (a HTML parser for python, see here)
pip install beautifulsoup4

# install django-celery (a Distributed Task Queue solution)
pip install django-celery

# install python-gcm (a google cloud messaging for Android push notification)
pip install python-gcm