Issue while installing mysql.connector in Python 2-7 after migrating from 2.6 -


mysql.connector used work expected in python 2.6 wanted use argparse, installed 2.7 version. facing below errors while installing connector version. not sure how resolve them.

**error while importing connector:**   [/usr/local/bin ] # python  python 2.7.6 (default, apr 19 2016, 19:36:47)  [gcc 4.4.7 20120313 (red hat 4.4.7-11)] on linux2   type "help", "copyright", "credits" or "license" more information.   >>> import mysql.connector   traceback (most recent call last):   file "<stdin>", line 1, in <module>   importerror: no module named mysql.connector   >>>  **paths located**  [~ ] # python2.6 /usr/bin/python2.6 [~ ] # python2.7 /usr/local/bin/python2.7 [~ ] # python /usr/local/bin/python [~ ] # ls -l /usr/local/bin/py* -rwxr-xr-x 1 root root      84 apr 19 18:10 /usr/local/bin/pydoc lrwxrwxrwx 1 root root      18 apr 19 21:57 /usr/local/bin/python ->      /usr/bin/python2.6 lrwxrwxrwx 1 root root       9 apr 19 18:10 /usr/local/bin/python2 ->  python2.7 -rwxr-xr-x 1 root root 6214541 apr 19 19:36 /usr/local/bin/python2.7 -rwxr-xr-x 1 root root    1674 apr 19 19:36 /usr/local/bin/python2.7-config  lrwxrwxrwx 1 root root      16 apr 19 18:10 /usr/local/bin/python2-config ->     python2.7-config  lrwxrwxrwx 1 root root      14 apr 19 18:10 /usr/local/bin/python-config -> python2-config  [~ ] # pip -v  pip 7.1.0 /usr/lib/python2.6/site-packages (python 2.6)   **trying install mysql connector python 2.7**    [/usr/src ] # rpm -i  mysql-connector-python-2.0.4-1.el7.noarch.rpm    error: failed dependencies:     python(abi) = 2.7 needed mysql-connector-python-2.0.4-1.el7.noarch 

i recommend installing mysql-connector-python package using pip same version of python you're using in repl you're trying import mysql.connector. so, if you're trying install mysql-connector-python, try install pip2.7 should in same directory python2.7 binary on machine.


Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -