How To Fix “ImportError: No module named ‘pymysql’”?
Are you having problems with the issue “ImportError: No module named ‘pymysql’“? How to fix it? In today’s article, I will provide solutions for you to solve the issues. Please follow the below steps to get the problem resolved now
How did “ImportError: No module named ‘pymysql’” occur?
ImportError: No module named ‘pymysql’
When you work with Python, you may get the issue ImportError: No module named ‘pymysql’. Don’t worry, we are here to provide you solutions in order to resolve your problem.
How to fix “ImportError: No module named ‘pymysql’”?
To solve ImportError – No module named “pymysql” Error If you are using Linux System, then install pymsql and pke this for Pip users: sudo pip install PyMySQL. For import use: import pymysql
Solution 1: Install Pymsql
All you need is pymsql
python3 -m pip install PyMySQL
Next, import pymsql as follows.
import pymysql
Now, your error must be fixed.
Solution 2: For Linux User
Install pymsql if you are using Linux System.
sudo pip install PyMySQL
To import.
import pymysql
Now, you must fix your problem.
Solution 3: For Python3
Python3 without pip? Install python3-pymysql like this.
sudo apt-get install python3-pymysql
To import.
import pymysql
Your problem now must be solved.
Final words
The above are useful solutions that can help you fix “ImportError: No module named ‘pymysql’” problem, if you can’t solve it well. Please leave a message.