How do I read a SQLite database in Python on VSCode?

Viewed 1277

I have learned on CS50 that we can configure a Library to use SQLite database, on CS50 IDE, by doing this:

from cs50 import SQL
db = SQL("sqlite:///finance.db")

Now I would like to do it in Visual Studio Code. But terminal returns me the following error: ModuleNotFoundError: No module named 'cs50'.

What do I have to do to read a SQLite database on VSCode?

2 Answers

Solved the problem simply typing pip install cs50 in the Terminal.

  1. In VS Code, you have to install a extension called python extension.

  2. You have to download python interpreter for you OS and then let the VS know where is your installed python by clicking

Ctrl + Shift + P

and then search for Python interpreter.

After setting up you can start coding in python importing any library, in your case CS50

Related