简体   繁体   中英

ModuleNotFoundError: No module named 'mysql' even when module is installed

I am fairly new to python and I am trying to write a script that would read and write to a mysql table. I have installed mysql-connector on python3 and I got the script working yesterday. It successfully read and wrote data to mysql. When I ran it today, this error came up. ModuleNotFoundError: No module named 'mysql'

I already checked the following things:

  • mysql-connector is installed
  • I don't have any user-defined module named mysql
  • not running on virtualenv

Does someone have any idea on what is happening?

check if mysql-connector is installed: python -m pip freeze. It is probably not listed. You can install it with:

pip install mysql-connector

or

python -m pip install mysql-connector

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM