django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named MySQLdb

前端 未结 23 1249
夕颜
夕颜 2020-12-02 10:51

The problem Im facing while trying to connect to database for mysql. I have also given the database settings that i have used.

 Traceback (most recent call l         


        
23条回答
  •  半阙折子戏
    2020-12-02 11:34

    My answer is similar to @Ron-E, but I got a few more errors/corrections so I'm putting my steps below for Mac OSX on Mavericks and Python 2.7.6.

    1. Install Python mysql package (if you get a success message, then ignore the below steps)

      pip install mysql-python
      
    2. When I did the above, I got the error "EnvironmentError: mysql_config not found" enter image description here To fix this, I did the below in terminal:

      export PATH=$PATH:/usr/local/mysql/bin
      
    3. When I reran step 1, I get a new error "error: command 'cc' failed with exit status 1" enter image description here To fix this, I did the below in terminal:

       export CFLAGS=-Qunused-arguments
       export CPPFLAGS=-Qunused-arguments
      
    4. I reran step 1 and got the success message 'Successfully installed mysql-python'!

提交回复
热议问题