No module named MySQLdb even if MySQL-python installed?

南笙酒味 提交于 2019-12-05 15:49:08

You need to force pip to use the default localization settings. Instead of:

pip install mysql-python

do:

LC_ALL=C pip install mysql-python

If you run into an error: Python.h: No such file or directory, then you'll need to install an additional library:

yum install python-devel

Some times we need to externally add/install git repo, This is not released yet but you can add from below command

pip install git+https://github.com/PyMySQL/mysqlclient-python.git

And

pip install mysql-python

and

yum install python-devel

You can use MySQL-python

For centos

yum install MySQL-python

Python 2.7.13 (default, Sep 26 2018, 18:42:22) 
[GCC 6.3.0 20170516] on linux2
Type "help", "copyright", "credits" or "license" for more information.

    >> import MySQLdb
    >> 
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!