Search code examples
pythonmysqldjangomysql-python

Install mysql-python (Windows)


I've spent hours trying to make Django work on my computer. The problem is that I can't install the mysql-python package. I'm running Windows 7 64bit. This is what I've tried:

  1. I have downloaded easy_install
  2. I have downloaded Cygwin64 to be able to run Linux commands (Win cmd was driving me crazy)
  3. I have typed in: easy_install mysql-python (gave me an error message saying it can't find vcvarsall.bat)
  4. I have downloaded Visual Studio 2010. However, I uninstalled it since I found out that I had some other version of it already (it didn't solve the problem)

EDIT: I discovered this: https://pypi.python.org/pypi/MySQL-python/1.2.5. Does this mean I can't run Django with python 3.3? And why bother to go through all this work if there is an .exe-file out there?


Solution

  • You're going to want to add Python to your Path Environment Variable in this way. Go to:

    1. My Computer
    2. System Properties
    3. Advance System Settings
    4. Under the "Advanced" tab click the button that says "Environment Variables"
    5. Then under System Variables you are going to want to add / change the following variables: PYTHONPATH and Path. Here is a paste of what my variables look like:

    PYTHONPATH

    C:\Python27;C:\Python27\Lib\site-packages;C:\Python27\Lib;C:\Python27\DLLs;C:\Python27\Lib\lib-tk;C:\Python27\Scripts
    

    Path

    C:\Program Files\MySQL\MySQL Utilities 1.3.5\;C:\Python27;C:\Python27\Lib\site-packages;C:\Python27\Lib;C:\Python27\DLLs;C:\Python27\Lib\lib-tk;C:\Python27\Scripts
    

    Your Path's might be different, so please adjust them, but this configuration works for me and you should be able to run MySQL after making these changes.