Reputation: 942
As the title says, i can't import mysql.connector in python on Debian 9.13
This is what i did
# python
Python 2.7.13 (default, Sep 26 2018, 18:42:22) [GCC 6.3.0 20170516] on
linux2 Type "help", "copyright", "credits" or "license" for more
information.
>>> import mysql.connector
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/mysql/connector/__init__.py", line 53, in <module>
from .connection import MySQLConnection
File "/usr/local/lib/python2.7/dist-packages/mysql/connector/connection.py", line 450
f"This connection is using {tls_version} which is now "
^
SyntaxError: invalid syntax
I tried installing, uninstalling and reinstalling mysql-connector, mysql-connector-python and mysql-connector-python-rf in Python2.7 and Python3
Before someone flags this question as duplicated, i already tried all the answers in this posts:
This connection is using {tls_version} which is now
Unresolved import mysql.connector PYTHON
ImportError: No module named 'MySQL'
This connection is using {tls_version} which is now, unable to deploy Flask application on Linux
Any help would be appreciated.
Upvotes: 0
Views: 3337
Reputation: 942
As @TimRoberts and @Dhivakar Chelladurai said in te comments, the solution is to find a version of MySQL-Connector-Python
for Python2 or Python3.5 max as this is the last version that Debian 9 has for Python3.
wget https://dev.mysql.com/get/Downloads/Connector-Python/mysql-connector-python_2.1.8-1debian9_all.deb
sudo dpkg -i mysql-connector-python_2.1.8-1debian9_all.deb
Thats it!
Upvotes: 1