2

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?

ARNON
  • 1,097
  • 1
  • 15
  • 33
  • 3
    It is the same steps. Assuming you have python set up. It is like asking I can Drive ford but how do I drive GM. – Yoshikage Kira May 24 '21 at 02:56
  • 1
    https://www.sqlite.org/docs.html – Yoshikage Kira May 24 '21 at 02:57
  • I understand. But the terminal is returning me: `ModuleNotFoundError: No module named 'cs50'`. I edited my question including this. – ARNON May 24 '21 at 11:27
  • 1
    that means that your interpreter can't find the package you are looking for. have you checked your environment to make sure the package is installed? – Scinana May 24 '21 at 11:56
  • I would just use sqlite3 since it comes in python preinstalled. cs50 seems like geared for Computer Science teaching course only. – Yoshikage Kira May 24 '21 at 16:46

2 Answers2

1

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

ARNON
  • 1,097
  • 1
  • 15
  • 33
1
  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