1

I am new to python. I installed the python tool on Visual Studio 2013. How do I install mysql package/module??? I need to write python code which will interact with mysql DB.

jruizaranguren
  • 12,679
  • 7
  • 55
  • 73
Yousuf Hossain
  • 172
  • 1
  • 12

1 Answers1

1

Try the windows installer for MySQL-python:

https://pypi.python.org/pypi/MySQL-python/1.2.5

Once installed properly, you should be able to run import MySQLdb

THK
  • 701
  • 4
  • 10
  • Note that there is no package "for" Visual Studio per se -- presumably you are just using Visual Studio as your IDE. – THK Dec 25 '14 at 02:58
  • I install python 3.4. When I try to install the windows installer it asks for python 2.7 – Yousuf Hossain Dec 25 '14 at 04:13
  • The package may not be compatible with Python 3.x -- you can proceed by installing Python 2.7 on your computer. – THK Dec 25 '14 at 05:47
  • Thank you it is working now. If I code python with this mysql library and python 2.7 will the code work on CENTOS linux??? – Yousuf Hossain Dec 26 '14 at 00:17
  • Yes, should work on any platform (including CentOS Linux), as long as you have Python 2.7 and MySQL-python installed. So on CentOS you'll probably need to pip install mysql-python. (Note that MySQL-python should work for some earlier versions of Python too, but your mileage may vary...). – THK Dec 26 '14 at 01:51