简体   繁体   中英

MySQLdb for Python 2.7 (Ubuntu)

After I installed MySQLdb by

sudo apt-get install python-mysqldb

I can import and use it when I use Python 2.6, but not 2.7. (ImportError: No module named MySQLdb)

I think that apt-get install MySQLdb in version 2.6, but I don't know how to make python 2.7 work with it. Please help me. Thanks a lot!

If you want system-wide installation for python2.7 you should use easy_install-2.7. Install setuptools (or distribute ) for python 2.7, then type:

easy_install-2.7 mysql-python

Update:

Or just

sudo apt-get install python2.7-mysqldb

Notice without adding sudo you'd not be able to make the changes.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM