close

[Solved] ImportError: No module named ‘pymysql’

Hello Guys, How are you all? Hope You all Are Fine. Today I am trying to import pymysql But I am facing following error ImportError: No module named ‘pymysql’ in Python. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How ImportError: No module named ‘pymysql’ Error Occurs ?

I am trying to import pymysql But I am facing following error.

ImportError: No module named 'pymysql'

How To Solve ImportError: No module named ‘pymysql’ Error ?

  1. How To Solve ImportError: No module named 'pymysql' Error ?

    To Solve ImportError: No module named 'pymysql' Error If You Are Using Linux System Then Install pymsql like this For Pip Users: sudo pip install PyMySQL And to import use: import pymysql Now, Your problem must be fixed.

  2. ImportError: No module named 'pymysql'

    To Solve ImportError: No module named 'pymysql' Error You Just need to install pymsql: python3 -m pip install PyMySQL And Then Import pymsql like this: import pymysql Now, Your error must be solved.

Solution 1: Install pymsql

You Just need to install pymsql

python3 -m pip install PyMySQL

And Then Import pymsql like this.

import pymysql

Now, Your error must be solved.

Solution 2: For Linux User

If You Are Using Linux System Then Install pymsql like this For Pip Users.

sudo pip install PyMySQL

And to import use.

import pymysql

Now, Your problem must be fixed.

Solution 3: For Python3

If You are using Python3 without pip Then Install python3-pymysql like this.

sudo apt-get install python3-pymysql

And to import use.

import pymysql

Now, Your problem must be fixed.

Summary

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you?

Also, Read

Leave a Comment