Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

import mysql.connector ImportError: No module named connector

1) sudo dpkg -i mysql-connector-python_1.0.12-1ubuntu12.04_all.deb

2) sudo dpkg -i mysql-utilities_1.3.5-1debian6.0_all.deb

(Reading database ... 50871 files and directories currently installed.)
Preparing to replace mysql-utilities 1.3.5 (using mysql-utilities_1.3.5-1debian6.0_all.deb) ...
Unpacking replacement mysql-utilities ...
postrm script for mysql-utilities
foundpython2.7
/opt/bitnami/python/lib/python2.7/site-packages
Setting up mysql-utilities (1.3.5) ...
postinst script for mysql-utilities
python2.7
found
python2.7
/opt/bitnami/python/lib/python2.7/site-packages
Processing triggers for man-db ...

(will supply parameter when it works )

3) trying to run mysqlrplcheck:

$ mysqlrplcheck
Traceback (most recent call last):
  File "./mysqlrplcheck", line 38, in <module>
    from mysql.utilities.common.server import check_hostname_alias
  File "/opt/bitnami/python/lib/python2.7/site-packages/mysql/utilities/common/server.py", line 29, in <module>
    import mysql.connector
ImportError: No module named connector

It does not find mysql.connector. How do I configure this?

like image 657
user2767144 Avatar asked Sep 11 '13 03:09

user2767144


1 Answers

user2767144 solved the problem by editing:

/usr/local/lib/python2.7/dist-packages/mysql/__init__.py

and adding:

from pkgutil import extend_path
path = extend_path(path, name)
like image 84
jaynp Avatar answered Sep 28 '22 11:09

jaynp