When installing packages using pip
, you might get this error:
ModuleNotFoundError: No module named 'ConfigParser'
The error occurs because the ConfigParser
module is not found in your current Python version.
In Python 3, the ConfigParser
module has been renamed to configparser
to comply with the PEP 8 style guide. Most likely, the package you want to install doesn’t support Python 3.
One library that’s been known to cause this error is the MySQL-python
package, which hasn’t released a version that supports Python 3 to this day.
Fortunately, there’s a fork of MYSQL-python
named mysqlclient
that supports Python 3.
You need to install mysqlclient
using pip
as shown below:
pip install mysqlclient
# or:
pip3 install mysqlclient
Once you installed the mysqlclient
library, you can use it just like MySQL-python
:
from MySQLdb import _mysql
db=_mysql.connect(host="localhost",user="root",
password="root",database="example")
If you’re installing another package, you need to check the Internet and see if there’s a replacement package available.
I hope this tutorial helps. See you next time! 👍