ImportError: No module named pymysql

146 views
Skip to first unread message

Kwangho Suh

unread,
Jun 24, 2020, 12:51:26 AM6/24/20
to PyMySQL Users
I've installed PyMySQL package.

# pip list
Package    Version
---------- -------
pip        
20.1.1
PyMySQL    0.9.3
setuptools
41.2.0


I wrote a code like the following:

import pymysql

but Python interpreter can't find PyMySQL package.
 
# python create_graph_images.py
Traceback (most recent call last):
 
File "create_graph_images.py", line 2, in <module>
   
import pymysql
ImportError: No module named pymysql


What should I do to fix this error?
Help me. plz.

Lucas Herculano

unread,
Jun 24, 2020, 7:05:47 AM6/24/20
to PyMySQL Users
Need more information
Are you using pyenv?
If yes can you tell what python is being used?
With:
# which python

If you are using pyenv try replacing your python with venv/bin/python* create_graph_images.py

John Lynch

unread,
Jun 30, 2020, 8:57:43 PM6/30/20
to PyMySQL Users
Reinstall it with your system package manager, e.g. apt on *ubuntu:
`sudo apt install python3-pymysql`
Then retry the `import pymysql`.
Reply all
Reply to author
Forward
0 new messages