ImportError: No module named MySQLdb

前端 未结 11 1208
难免孤独
难免孤独 2020-12-02 05:28

I am referring the following tutorial to make a login page for my web application. http://code.tutsplus.com/tutorials/intro-to-flask-signing-in-and-out--net-29982

I

相关标签:
11条回答
  • 2020-12-02 05:53

    My issue is :

    return __import__('MySQLdb')
    ImportError: No module named MySQLdb
    

    and my resolution :

    pip install MySQL-python
    yum install mysql-devel.x86_64
    

    at the very beginning, i just installed MySQL-python, but the issue still existed. So i think if this issue happened, you should also take mysql-devel into consideration. Hope this helps.

    0 讨论(0)
  • 2020-12-02 05:57

    In ubuntu 20 , you can try this :

    sudo apt-get install libmysqlclient-dev
    sudo apt-get install gcc
    pip install mysqlclient
    
    0 讨论(0)
  • 2020-12-02 06:01

    Got so many errors related to permissions and what not. You may wanna try this :

    xcode-select --install
    
    0 讨论(0)
  • 2020-12-02 06:05

    may you try

    pip install mysqlclient
    
    0 讨论(0)
  • 2020-12-02 06:06

    If you're having issues compiling the binary extension, or on a platform where you cant, you can try using the pure python PyMySQL bindings.

    Simply pip install pymysql and switch your SQLAlchemy URI to start like this:

    SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://.....'
    

    There are some other drivers you could also try.

    0 讨论(0)
提交回复
热议问题