2

I am unable to resolve this issue for a day now. when i try to execute my django project, pycharm throws the error "No module named 'MySQLdb'". From reference to similar questions on SO. I did try to install packages through file settings, that raises another error

"Could not find a version that satisfies the requirement MySQLdb (from versions: )
No matching distribution found for MySQLdb"

My project requires python 3.6 and the project doesn't seem to be working without MysqlDB. I did try to install mysqlAlchemy and mysqlconnector but it is of no use. Can some one point out how to resolve this ?

I am on mac and there is no issue if i try to run the project from terminal.

EDIT : I did try to install mysql from the pycharm package manager. But it throws another error No module named 'ConfigParser'

Naveen Kumar
  • 1,476
  • 5
  • 28
  • 52
  • 1
    Possible duplicate of [How to install Python MySQLdb module using pip?](https://stackoverflow.com/questions/25865270/how-to-install-python-mysqldb-module-using-pip) It lists the mac instructions there... – metatoaster Jan 20 '18 at 06:48
  • @metatoaster i am not able to install mysql through package manager of pycharm since it throws the error no module found 'configparser' – Naveen Kumar Jan 20 '18 at 06:53
  • [Python 3 ImportError: No module named 'ConfigParser'](https://stackoverflow.com/questions/14087598/python-3-importerror-no-module-named-configparser) – metatoaster Jan 20 '18 at 06:56
  • For the edit, it's a duplicate of [Connect MySQL with Python 3.6](https://stackoverflow.com/questions/42515854/connect-mysql-with-python-3-6) – metatoaster Jan 20 '18 at 06:58

1 Answers1

5

It's a common problem in python3.5.3, you may need to pip install pymysql and add the following code to __init__.py at the same directory as wsgi.py. Wish you good luck!

import pymysql
pymysql.install_as_MySQLdb()
li zhen
  • 59
  • 3
  • I have no idea what "you may need to pip install pymysql and add the following code to __init__.py at the same directory as wsgi.py" means but I added import pymysql pymysql.install_as_MySQLdb() to the top of my .py script and it worked. – Jak Dec 12 '19 at 17:06