Installation error on mac (manually)

I am encountering errors again and really need help. Been at the issue for weeks now. Few weeks ago I tried to update my bench but encountered an error which I posted here - Error when running bench update (MacOS)

Since nothing works, I uninstalled mariadb. Here are the commands I ran:

brew remove mariah
brew install mariadb

pip uninstall MySQL-python
pip install MySQL-python

After I ran this, I can’t get the last command done. It shows me the error below:

pip install MySQL-python
Collecting MySQL-python
  Using cached MySQL-python-1.2.5.zip
Building wheels for collected packages: MySQL-python
  Running setup.py bdist_wheel for MySQL-python ... error
  Complete output from command /usr/local/opt/python/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/p6/yyn74c_d3cb3yppcz1cv_85w0000gn/T/pip-build-CQikXQ/MySQL-python/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /var/folders/p6/yyn74c_d3cb3yppcz1cv_85w0000gn/T/tmpxEGSa9pip-wheel- --python-tag cp27:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-10.12-x86_64-2.7
  copying _mysql_exceptions.py -> build/lib.macosx-10.12-x86_64-2.7
  creating build/lib.macosx-10.12-x86_64-2.7/MySQLdb
  copying MySQLdb/__init__.py -> build/lib.macosx-10.12-x86_64-2.7/MySQLdb
  copying MySQLdb/converters.py -> build/lib.macosx-10.12-x86_64-2.7/MySQLdb
  copying MySQLdb/connections.py -> build/lib.macosx-10.12-x86_64-2.7/MySQLdb
  copying MySQLdb/cursors.py -> build/lib.macosx-10.12-x86_64-2.7/MySQLdb
  copying MySQLdb/release.py -> build/lib.macosx-10.12-x86_64-2.7/MySQLdb
  copying MySQLdb/times.py -> build/lib.macosx-10.12-x86_64-2.7/MySQLdb
  creating build/lib.macosx-10.12-x86_64-2.7/MySQLdb/constants
  copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.12-x86_64-2.7/MySQLdb/constants
  copying MySQLdb/constants/CR.py -> build/lib.macosx-10.12-x86_64-2.7/MySQLdb/constants
  copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.12-x86_64-2.7/MySQLdb/constants
  copying MySQLdb/constants/ER.py -> build/lib.macosx-10.12-x86_64-2.7/MySQLdb/constants
  copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.12-x86_64-2.7/MySQLdb/constants
  copying MySQLdb/constants/REFRESH.py -> build/lib.macosx-10.12-x86_64-2.7/MySQLdb/constants
  copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.12-x86_64-2.7/MySQLdb/constants
  running build_ext
  building '_mysql' extension
  creating build/temp.macosx-10.12-x86_64-2.7
  clang -fno-strict-aliasing -fno-common -dynamic -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 -I/usr/local/Cellar/mariadb/10.2.6/include/mysql -I/usr/local/Cellar/mariadb/10.2.6/include/mysql/.. -I/usr/local/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _mysql.c -o build/temp.macosx-10.12-x86_64-2.7/_mysql.o
  In file included from _mysql.c:44:
  /usr/local/Cellar/mariadb/10.2.6/include/mysql/my_config.h:286:11: warning: 'SIZEOF_SIZE_T' macro redefined [-Wmacro-redefined]
    #define SIZEOF_SIZE_T  SIZEOF_LONG
            ^
  /usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/include/python2.7/pymacconfig.h:43:17: note: previous definition is here
  #        define SIZEOF_SIZE_T           8
                  ^
  _mysql.c:266:44: warning: unused variable 's' [-Wunused-variable]
          char **cmd_args_c=NULL, **groups_c=NULL, *s;
                                                    ^
  _mysql.c:267:21: warning: unused variable 'groupc' [-Wunused-variable]
          int cmd_argc=0, i, groupc;
                             ^
  _mysql.c:267:18: warning: unused variable 'i' [-Wunused-variable]
          int cmd_argc=0, i, groupc;
                          ^
  _mysql.c:268:53: warning: unused variable 'item' [-Wunused-variable]
          PyObject *cmd_args=NULL, *groups=NULL, *ret=NULL, *item;
                                                             ^
  _mysql.c:351:3: warning: unused label 'finish' [-Wunused-label]
    finish:
    ^~~~~~~
  _mysql.c:267:6: warning: unused variable 'cmd_argc' [-Wunused-variable]
          int cmd_argc=0, i, groupc;
              ^
  _mysql.c:1589:10: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
          if (how < 0 || how >= sizeof(row_converters)) {
              ~~~ ^ ~
  _mysql.c:1943:47: warning: incompatible pointer types passing 'MYSQL *' (aka 'struct st_mysql *') to parameter of type 'MYSQL_RES *' (aka 'struct st_mysql_res *') [-Wincompatible-pointer-types]
          return PyInt_FromLong((long)mysql_num_fields(&(self->connection)));
                                                       ^~~~~~~~~~~~~~~~~~~
  /usr/local/Cellar/mariadb/10.2.6/include/mysql/mysql.h:470:50: note: passing argument to parameter 'res' here
  unsigned int STDCALL mysql_num_fields(MYSQL_RES *res);
                                                   ^
  _mysql.c:2005:42: error: no member named 'reconnect' in 'struct st_mysql'
          if ( reconnect != -1 ) self->connection.reconnect = reconnect;
                                 ~~~~~~~~~~~~~~~~ ^
  _mysql.c:2085:3: error: too few arguments to function call, expected 2, have 1
                  );
                  ^
  /usr/local/Cellar/mariadb/10.2.6/include/mysql/mysql.h:518:1: note: 'mysql_shutdown' declared here
  int             STDCALL mysql_shutdown(MYSQL *mysql, enum mysql_enum_shutdown_level shutdown_level);
  ^
  9 warnings and 2 errors generated.
  error: command 'clang' failed with exit status 1
  
  ----------------------------------------
  Failed building wheel for MySQL-python
  Running setup.py clean for MySQL-python
Failed to build MySQL-python
Installing collected packages: MySQL-python
  Running setup.py install for MySQL-python ... error
    Complete output from command /usr/local/opt/python/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/p6/yyn74c_d3cb3yppcz1cv_85w0000gn/T/pip-build-CQikXQ/MySQL-python/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/p6/yyn74c_d3cb3yppcz1cv_85w0000gn/T/pip-vDYZ9W-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.12-x86_64-2.7
    copying _mysql_exceptions.py -> build/lib.macosx-10.12-x86_64-2.7
    creating build/lib.macosx-10.12-x86_64-2.7/MySQLdb
    copying MySQLdb/__init__.py -> build/lib.macosx-10.12-x86_64-2.7/MySQLdb
    copying MySQLdb/converters.py -> build/lib.macosx-10.12-x86_64-2.7/MySQLdb
    copying MySQLdb/connections.py -> build/lib.macosx-10.12-x86_64-2.7/MySQLdb
    copying MySQLdb/cursors.py -> build/lib.macosx-10.12-x86_64-2.7/MySQLdb
    copying MySQLdb/release.py -> build/lib.macosx-10.12-x86_64-2.7/MySQLdb
    copying MySQLdb/times.py -> build/lib.macosx-10.12-x86_64-2.7/MySQLdb
    creating build/lib.macosx-10.12-x86_64-2.7/MySQLdb/constants
    copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.12-x86_64-2.7/MySQLdb/constants
    copying MySQLdb/constants/CR.py -> build/lib.macosx-10.12-x86_64-2.7/MySQLdb/constants
    copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.12-x86_64-2.7/MySQLdb/constants
    copying MySQLdb/constants/ER.py -> build/lib.macosx-10.12-x86_64-2.7/MySQLdb/constants
    copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.12-x86_64-2.7/MySQLdb/constants
    copying MySQLdb/constants/REFRESH.py -> build/lib.macosx-10.12-x86_64-2.7/MySQLdb/constants
    copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.12-x86_64-2.7/MySQLdb/constants
    running build_ext
    building '_mysql' extension
    creating build/temp.macosx-10.12-x86_64-2.7
    clang -fno-strict-aliasing -fno-common -dynamic -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 -I/usr/local/Cellar/mariadb/10.2.6/include/mysql -I/usr/local/Cellar/mariadb/10.2.6/include/mysql/.. -I/usr/local/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _mysql.c -o build/temp.macosx-10.12-x86_64-2.7/_mysql.o
    In file included from _mysql.c:44:
    /usr/local/Cellar/mariadb/10.2.6/include/mysql/my_config.h:286:11: warning: 'SIZEOF_SIZE_T' macro redefined [-Wmacro-redefined]
      #define SIZEOF_SIZE_T  SIZEOF_LONG
              ^
    /usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/include/python2.7/pymacconfig.h:43:17: note: previous definition is here
    #        define SIZEOF_SIZE_T           8
                    ^
    _mysql.c:351:3: warning: unused label 'finish' [-Wunused-label]
      finish:
      ^~~~~~~
    _mysql.c:267:21: warning: unused variable 'groupc' [-Wunused-variable]
            int cmd_argc=0, i, groupc;
                               ^
    _mysql.c:266:44: warning: unused variable 's' [-Wunused-variable]
            char **cmd_args_c=NULL, **groups_c=NULL, *s;
                                                      ^
    _mysql.c:267:6: warning: unused variable 'cmd_argc' [-Wunused-variable]
            int cmd_argc=0, i, groupc;
                ^
    _mysql.c:267:18: warning: unused variable 'i' [-Wunused-variable]
            int cmd_argc=0, i, groupc;
                            ^
    _mysql.c:268:53: warning: unused variable 'item' [-Wunused-variable]
            PyObject *cmd_args=NULL, *groups=NULL, *ret=NULL, *item;
                                                               ^
    _mysql.c:1589:10: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
            if (how < 0 || how >= sizeof(row_converters)) {
                ~~~ ^ ~
    _mysql.c:1943:47: warning: incompatible pointer types passing 'MYSQL *' (aka 'struct st_mysql *') to parameter of type 'MYSQL_RES *' (aka 'struct st_mysql_res *') [-Wincompatible-pointer-types]
            return PyInt_FromLong((long)mysql_num_fields(&(self->connection)));
                                                         ^~~~~~~~~~~~~~~~~~~
    /usr/local/Cellar/mariadb/10.2.6/include/mysql/mysql.h:470:50: note: passing argument to parameter 'res' here
    unsigned int STDCALL mysql_num_fields(MYSQL_RES *res);
                                                     ^
    _mysql.c:2005:42: error: no member named 'reconnect' in 'struct st_mysql'
            if ( reconnect != -1 ) self->connection.reconnect = reconnect;
                                   ~~~~~~~~~~~~~~~~ ^
    _mysql.c:2085:3: error: too few arguments to function call, expected 2, have 1
                    );
                    ^
    /usr/local/Cellar/mariadb/10.2.6/include/mysql/mysql.h:518:1: note: 'mysql_shutdown' declared here
    int             STDCALL mysql_shutdown(MYSQL *mysql, enum mysql_enum_shutdown_level shutdown_level);
    ^
    9 warnings and 2 errors generated.
    error: command 'clang' failed with exit status 1
    
    ----------------------------------------
Command "/usr/local/opt/python/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/p6/yyn74c_d3cb3yppcz1cv_85w0000gn/T/pip-build-CQikXQ/MySQL-python/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/p6/yyn74c_d3cb3yppcz1cv_85w0000gn/T/pip-vDYZ9W-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/p6/yyn74c_d3cb3yppcz1cv_85w0000gn/T/pip-build-CQikXQ/MySQL-python/

It looks as if there is an error in the script. I even tried uninstalling Xcode command line tools and reinstalling it back. And ran the commands again. Still the same error.

I am running MacOS Sierra. Any help is greatly appreciated!