Home > database >  ModuleNotFoundError: No module named 'mysql' continuously occuring in VS Code despite mult
ModuleNotFoundError: No module named 'mysql' continuously occuring in VS Code despite mult

Time:05-09

I seem to be facing this error continuously despite:

  • Installing the mysql-connector via "python -m pip install mysql-connector-python"
  • Installing the MySQL package via "pip install MySQL"

I have confirmed that I have installed the package as it says "Requirement already satisfied everytime I run it again in the terminal". Additionally, I have tried installing and reinstalling the package as well.

But all the results are the same. Each time I run my script and try to "import mysql.connector", I always get the ModuleNotFoundError: No module named 'mysql' error

Would greatly appreciate some help. Thank you very much

CodePudding user response:

maybe you may wanna try and use python 3 instead of python to check or install the library.

CodePudding user response:

Do you use virtual environments? If it is a virtual environment, please copy the contents in the expansion package folder of the virtual environment to the package folder under python.

If you have two versions of Python in your system, you may also encounter this problem. "CTRL SHIFT P" and choose the correct interpreter.

enter image description here

You can use the following method to check and see where pip installed the package:

pip show MySQL
  • Related