I used
python3 -m pip install mysqlclient
and it installed successfully.
However when I try to import this into my python code using
import mysqlclient as sql
It comes up with
ImportError: No module named 'mysqlclient'
What am I doing wrong that doesn't allow me to import this module.
This project is a fork of MySQLdb1. This project adds Python 3 support and fixed many bugs.
Turns out its
import MySQLdb
I was previously using
import mysqldb
which didnt work
If you are getting an error, then probably the package is not installed properly !
Here are some alternatives to install mysqlclient
Install from source
Download source by git clone or zipfile.
Customize site.cfg
python setup.py install
You can visit this site for Python3.5 and Python3.6 and download the .whl package.
Next step is to install the .whl package, (for example) if you have Python3.5, you can :
pip install mysqlclient-1.3.10-cp35-cp35m-win32.whl
And use,
import MySQLdb as sql
to import the module.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With