0

Hardware configuration

I'm configuring my new MacBook Air with Apple silicon M1 chip and obviously mac os 11 Big Sur.

Environment

I have installed

With Homebrew:

  • mysql@5.7

With pyenv@1.2.21:

  • python@3.6.5

With pip@20.3.3:

  • mysqlclient==1.4.2.post1

The issue

I work with Django framework and the last step for me is to configure the MySQL database on localhost. MySQL server is running and I can use it from the shell and access it by SequelPro. When I run python manage.py migrate I have this problem :

django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module.
Did you install mysqlclient?

The database configuration is: DATABASE environment

Does someone have the same problem?

  • Have you tried ```pip install mysqlclient``` ? – Guillaume Jan 01 '21 at 10:46
  • @BriseBalloches Yes, but still have this issue – Davide Ria Jan 01 '21 at 13:19
  • and did you edit __init__.py file as in this post suggests https://stackoverflow.com/questions/46902357/error-loading-mysqldb-module-did-you-install-mysqlclient-or-mysql-python – Guillaume Jan 01 '21 at 13:51
  • @BriseBalloches I can't use pymysql because I'm not the only one who uses this project. I have tried with this package but he gives me another error: `AttributeError: 'str' object has no attribute 'decode'`. I search for this error and I found this: https://stackoverflow.com/questions/56820895/migrations-error-in-django-2-attributeerror-str-object-has-no-attribute-dec for me is not the right solution. I don't want to change the code of django/backends it would be unsustainable. I hope you understand my doubts. – Davide Ria Jan 01 '21 at 14:27

1 Answers1

0

try this command :

pip3 install mysqlclient

Here is documentation : https://pypi.org/project/mysqlclient/


Dharman
  • 30,962
  • 25
  • 85
  • 135
R.A.M
  • 82
  • 1
  • 8