简体   繁体   中英

ImportError: No module named PyMySQL

I have installed python 3 using this command

sudo apt-get install python3-minimal

after that I have downloaded python extension in vs code. I want to connect it to mySql database but as I write

import PyMySQL

It shows this stack trace

Unable to import 'PyMySQL'pylint(import-error)

You need to also install python3-pymysql

sudo apt-get install python3-pymysql

And your import should be lowercase:

import pymysql

EDIT: Make sure that you have started the same python interpreter from the same installation (check version displayed in python prompt when starting)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM