3

I want to connect to mysql database from python

I tried to do this: pip install mysql-python as this question suggested No module named MySQLdb

but I got this exception

Cleaning up...
Command C:\Python27\python.exe -c "import setuptools, tokenize;__file__='c:\\use
rs\\user\\appdata\\local\\temp\\pip_build_User\\mysql-python\\setup.py';exec(com
pile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __f
ile__, 'exec'))" install --record c:\users\user\appdata\local\temp\pip-kkagjy-re
cord\install-record.txt --single-version-externally-managed --compile failed wit
h error code 1 in c:\users\user\appdata\local\temp\pip_build_User\mysql-python
Storing debug log for failure in C:\Users\User\pip\pip.log

In my python code, I keep getting this error

No module named MySQLdb

I am using windows 7

Community
  • 1
  • 1
Marco Dinatsoli
  • 10,322
  • 37
  • 139
  • 253
  • You need a c compiler and a tool chain setup to install this. Do you have a c compiler installed? What operating system are you using? You might want to look at this blog post: http://mysql-python.blogspot.ca/2012/11/is-mysqldb-hard-to-install.html – shuttle87 Jun 08 '14 at 22:06
  • @shuttle87 I am using windows 7 – Marco Dinatsoli Jun 08 '14 at 22:07
  • @shuttle87 the blog you suggested stats that I must have `vs2008` and that is impossible now. I have `vs2012` – Marco Dinatsoli Jun 08 '14 at 22:11

1 Answers1

1

I found the solution myself

http://www.codegood.com/archives/129

download that and it is enough

Marco Dinatsoli
  • 10,322
  • 37
  • 139
  • 253
  • If you want a more up-to-date repository have a look at [http://www.lfd.uci.edu/~gohlke/pythonlibs/#mysql-python](http://www.lfd.uci.edu/~gohlke/pythonlibs/#mysql-python). – Matthias Jun 08 '14 at 22:30