Вопрос

I'm running Linux Mint 13 and Python 2.7.3 and I'm trying to install mysqldb, but can't import it. I run:

sudo apt-get install build-essential python-dev libmysqlclient-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
build-essential is already the newest version.
libmysqlclient-dev is already the newest version.
python-dev is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 465 not upgraded.

sudo pip install MySQL-python
Requirement already satisfied (use --upgrade to upgrade): MySQL-python in /usr/local/lib/python2.7/dist-packages
Cleaning up...

Within the python command line, I run:

import MYSQLdb
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named MYSQLdb

I've also tried:

sudo apt-get install python-mysqldb

Any ideas?

Это было полезно?

Решение

It should be import MySQLdb, not import MYSQLdb. Case matters.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top