Reputation: 2625
I'm literally stuck! I have Python version 3.3 and MySQLdb seems to only support Python 2.7 or under and I have no idea what to do. I'm trying to follow tutorials from www.djangobook.com and they recommend using MySQL but they link to an outdated version of MySQLdb that only supports Python 2.7 or less.
I downloaded MySQL-Connector-Python from here: https://pypi.python.org/pypi/mysql-connector-python
Then I installed it.
Then I tried to import MySQLdb.
C:\>python
Python 3.3.3 (v3.3.3:c3896275c0f6, Nov 18 2013, 21:19:30) [MSC v.1600 64 bit (AM
D64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import MySQLdb
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'MySQLdb'
>>>
Basically, I'm trying to get MySQLdb into Python33 and move onto the next part in the tutorial. So, I have no idea where I can get MySQLdb that works and how I can install it.
Other information: Windows 7, 64bit, Python33, Django web development
Upvotes: 0
Views: 1100
Reputation: 6414
In windows
download pip: https://raw.github.com/pypa/pip/master/contrib/get-pip.py
run: python get-pip.py
to install pip
then use pip install what you want
pip install MySQL-python
Upvotes: 2
Reputation: 56
did you check this module https://github.com/petehunt/PyMySQL/
import pymysql
conn = pymysql.connect(host='127.0.0.1', unix_socket='/tmp/mysql.sock', user='root', passwd=None, db='mysql')
cur = conn.cursor()
cur.execute("SELECT Host,User FROM user")
for response in cur:
print(response)
cur.close()
conn.close()
Upvotes: 2