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.
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.
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With