0

I am encountering an issue with a ModuleNotFoundError when trying to import the mysql.connector module in my Python script. I have already installed the module using pip install mysql-connector-python, but I still can't seem to resolve the error.

1.Checked Python version: 3.11.1

2.Executed pip show mysql-connector-python:

Name: mysql-connector-python

Version: 8.3.0

Summary: MySQL driver written in Python.

3.Checked virtual environment activation:

Virtual environment is activated.

4.Reinstalled MySQL Connector:

pip uninstall mysql-connector-python  
pip install mysql-connector-python
4
  • 1
    What is your OS? can you add output from pip --version and python --version, can you place how are you staring script? I did pip install mysql-connector-python and python3 -c 'import mysql.connector' on clean system and it works fine Commented Jan 22, 2024 at 8:26
  • OS: Windows, pip version : pip 23.3.2, python version : Python 3.11.1. It didn't work. Commented Jan 22, 2024 at 12:29
  • Do you have other python version in the system? try using python3 -m pip install mysql-connector-python to install it, then again it python3 -c 'import mysql.connector' Commented Jan 22, 2024 at 12:48
  • Yes, another Python version was there. I uninstalled the previous versions and installed the latest Python version. Then, I used pip install mysql-connector-python, and it worked without any issues. Commented Mar 7, 2024 at 8:22

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.