title: Fresh python 3.7 / django 2.2.1 installation not recognising that mysqlclient is installed
body: <p>I have a brand new django 2.2.1 project I have just installed into a python 3.7 virtualenv on OS X (10.14.4). After some frustrations I got mysqlclient to install but when I run the django dev server it doesn't recognise that it is installed:</p>
  
  <p>Here are the steps I've taken so far:</p>
  
  <pre><code>brew install mysql
  pipenv --three
  pipenv install django==2.2.1
  pipenv install mysqlclient
  brew uninstall mysql
  brew install mysql-connector-c
  pipenv install mysqlclient
  brew unlink mysql-connector-c
  brew install mysql
  django-admin startproject projectname
  </code></pre>
  
  <p>Now, the only change I have made to the out-of-the-box django installation is to change the default database backend to django.db.backends.mysql and when I run the django server I get the following:</p>
  
  <pre><code>django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module.
  Did you install mysqlclient?
  </code></pre>
  
  <p>However, going back to the virtualenv and doing "pip install mysqlclient" gives:</p>
  
  <pre><code>Requirement already satisfied: mysqlclient in /Users/&lt;username&gt;/.local/share/virtualenvs/&lt;projectname&gt;-KrUE_JNo/lib/python3.7/site-packages (1.4.2.post1)
  </code></pre>
  
  <p>Any ideas why django can't see the mysqlclient installed in the virtualenv? I can confirm that all of the above has been run in the virtualenv. I suspect it has something to do with the faff that OSX makes you go through to install it but I'm not sure how to pick it apart.</p>
  
  <p>I have also tried to <a href="https://stackoverflow.com/questions/46902357/error-loading-mysqldb-module-did-you-install-mysqlclient-or-mysql-python">replace mysqldb with pymysql as suggested here</a> but that causes the server to give a different error:</p>
  
  <pre><code>raise ImproperlyConfigured('mysqlclient 1.3.13 or newer is required; you have %s.' % Database.__version__)
  django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.13 or newer is required; you have 0.9.3.
  </code></pre>
  
  <p>Mysql is a given for this project so use of an alternative backend is not an option. Any help very gratefully received, many thanks in advance.</p>
  
  <p>UPDATE: Output of pip freeze:</p>
  
  <pre><code>Django==2.2.1
  django-auth-ldap==1.7.0
  Markdown==3.1
  mysql-connector-python==8.0.16
  mysqlclient==1.4.2.post1
  protobuf==3.7.1
  pyasn1==0.4.5
  pyasn1-modules==0.2.5
  PyMySQL==0.9.3
  pyodbc==4.0.26
  python-ldap==3.2.0
  pytz==2019.1
  simplejson==3.16.0
  six==1.12.0
  sqlparse==0.3.0
  xmltodict==0.12.0
  </code></pre>
  
  <p>UPDATE 2:
  Following conor's post (thanks conor) I started again with a fresh virtualenv and again successfully installed mysqlclient1.4.2.post1. Here's the output from pip freeze now:</p>
  
  <pre><code>Django==2.2.1
  mysqlclient==1.4.2.post1
  pytz==2019.1
  sqlparse==0.3.0
  </code></pre>
  
  <p>Still getting the same error when I do python manage.py runserver though:</p>
  
  <pre><code>django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module.
  Did you install mysqlclient?
  </code></pre>
  
  <p>UPDATE 3:
  Thought I would try importing the MySQLdb module on the python command line to see if I can get any more insight and it returns the following:</p>
  
  <pre><code>&gt;&gt;&gt; import MySQLdb
  Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
    File "/Users/&lt;username&gt;/.local/share/virtualenvs/&lt;projectname&gt;-KrUE_JNo/lib/python3.7/site-packages/MySQLdb/__init__.py", line 18, in &lt;module&gt;
      from . import _mysql
  ImportError: dlopen(/Users/&lt;username&gt;/.local/share/virtualenvs/&lt;projectname&gt;-KrUE_JNo/lib/python3.7/site-packages/MySQLdb/_mysql.cpython-37m-darwin.so, 2): Symbol not found: _mysql_affected_rows
    Referenced from: /Users/&lt;username&gt;/.local/share/virtualenvs/&lt;projectname&gt;-KrUE_JNo/lib/python3.7/site-packages/MySQLdb/_mysql.cpython-37m-darwin.so
    Expected in: flat namespace
   in /Users/&lt;username&gt;/.local/share/virtualenvs/&lt;projectname&gt;-KrUE_JNo/lib/python3.7/site-packages/MySQLdb/_mysql.cpython-37m-darwin.so
  </code></pre>