ImportError: No module named parse


When trying to import mysql connector, below error thrown.

Traceback (most recent call last):
  File "", line 7, in <module>
    import mysql.connector
  File "/usr/lib/python2.7/site-packages/mysql/connector/", line 53, in <module>
    from .connection import MySQLConnection
  File "/usr/lib/python2.7/site-packages/mysql/connector/", line 39, in <module>
    from .authentication import get_auth_plugin
  File "/usr/lib/python2.7/site-packages/mysql/connector/", line 37, in <module>
    from urllib.parse import quote
ImportError: No module named parse


There are two python versions installed in your system and you try to conflict both the version while import of package

Remove the python binary of old version

sudo rm /usr/bin/python

Symbolic link the new version of python

 sudo ln -s /usr/bin/python3 /usr/bin/python

Check the version

python --version

Import the package

import mysql.connector

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s