I have executed the following command to install mysqldb :
apt-get install python-mysqldb
it returned :
Reading package lists... Done
Building dependency tree
Reading state information... Done
python-mysqldb is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 381 not upgraded.
But when i try to run a file with code :
import MySqldb;
through
python index.py
it returns :
Traceback (most recent call last):
File "index.py", line 1, in <module>
import MySqldb;
ImportError: No module named MySqldb
Please help..??
The module is called MySQLdb
- watch the case:
import MySQLdb
Demo:
>>> import MySqldb
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named MySqldb
>>> import MySQLdb
>>> MySQLdb.__version__
'1.2.5'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.