Search code examples
pythonansibleimporterrorpymysql

not able to import pymysql module in python3


I have downloaded the PyMySql using sudo pip3 install pymysql and it showed that python module was installed successfully. enter image description here

But when I try to import it, it is showing that no module is available with this name. enter image description here

Actually I was writing a playbook for mysql root user password updation in Ansible where Ansible needs this pymysql module.


Solution

  • enter image description here

    I logged in as root user then uninstalled the previously installed pymysql and then again installed the pymysql from root user and now it is working perfectly fine. so try to avoid installing something from pip using sudo.