Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No module named 'pymysql'

I'm trying to use PyMySQL on Ubuntu.

I've installed pymysql using both pip and pip3 but every time I use import pymysql, it returns ImportError: No module named 'pymysql'

I'm using Ubuntu 15.10 64-bit and Python 3.5.

The same .py works on Windows with Python 3.5, but not on Ubuntu.

like image 383
troyz Avatar asked Oct 30 '15 23:10

troyz


People also ask

How do I fix No module named PyMySQL?

The Python "ModuleNotFoundError: No module named 'pymysql'" occurs when we forget to install the PyMySQL module before importing it or install it in an incorrect environment. To solve the error, install the module by running the pip install PyMySQL command.

What is PyMySQL module in Python?

PyMySQL is an interface for connecting to a MySQL database server from Python. It implements the Python Database API v2. 0 and contains a pure-Python MySQL client library. The goal of PyMySQL is to be a drop-in replacement for MySQLdb.


1 Answers

Sort of already answered this in the comments, but just so this question has an answer, the problem was resolved through running:

sudo apt-get install python3-pymysql 
like image 169
user530873 Avatar answered Oct 02 '22 06:10

user530873