mysql - ImportError: No module named 'MySQLdb' -
i did lot of research couldn't find solution keep getting error:
traceback (most recent call last): file "test.py", line 2, in <module> import mysqldb importerror: no module named 'mysqldb'
i installed well: , got this.
yesh@yesh:~/dbms$ sudo apt-get install python-mysqldb reading package lists... done building dependency tree reading state information... done python-mysqldb newest version. 0 upgraded, 0 newly installed, 0 remove , 0 not upgraded.
someone please me this. guess has environment variables. don't know is. in advance
first ensure have python mysql driver installed:
sudo pip install pymysql
add settings.py:
# pymysql try: import pymysql pymysql.install_as_mysqldb() except importerror: pass
you can test works trying this:
$ ipython import mysqldb #confirm error import pymysql pymysql.install_as_mysqldb() import mysqldb #no error
Comments
Post a Comment