Forums

Error import mysql.connector in the task panel

I want to install the mysql.connector in my account to perform a specific task in the task pane, but I'm not getting. already tried to execute the following commands in the bash console

"pip install mysql-connector"

"pip install mysql-connector-python"

but when I run the command

"import mysql.connector" in the task pane

the following message appears:

Dec 25 19:27:14 import mysql.connector Dec 25 19:27:14 ModuleNotFoundError: No module named 'mysql.connector'; 'mysql' is not a package

how to resolve this error?

thank you!

Make sure that you are installing it in the same environment you are running your code.

Also. take a look at https://help.pythonanywhere.com/pages/DebuggingImportError/ and https://help.pythonanywhere.com/pages/InstallingNewModules/

Thanks, it worked!

in the same directory as my script had a mysql.py file so it was going wrong.

I ran the pip3.7 install --user mysql-connector command and then deleted the mysql.py file