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