0

I use Anaconda for my Python installation. I faced with problem that sqlite3 distributed by conda is not built with the optional but useful FTS5 extension: https://github.com/ContinuumIO/anaconda-issues/issues/9034

I decided to compile SQLite for using with Python as described here: https://charlesleifer.com/blog/compiling-sqlite-for-use-with-python-applications/

I do standalone install to virtual environment and faced with problems on this step:

python setup.py build_static

The problem is described here: error: command 'C:\\ Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.14.26428\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2

This is my error message:

error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.13.26128\bin\HostX86\x64\cl.exe' failed with exit status 2

I tried solutions described by this link and in similar threads.

I installed Visual Studio Community 2017 icluding VC++ 2017 Tools, Windows 10 SDK, Windows 8.1 SDK

I tried "MySQL Connector C 6.0.2" with creating hard link according to these links: https://stackoverflow.com/a/52451604 https://stackoverflow.com/a/16619567

Could you, please, provide more detailed explanation about how Anaconda is linked with Visual Studio Tools and how to fix this error. Or, probably, is there more simple way to compile SQLite for use with Python?

Akra Bato
  • 9
  • 1
  • 5

1 Answers1

0

Personally, I prefer to use sqlite by importing the cs50 library. It provides a smooth integration and is perfect for intermediate/beginner use.

  1. To install cs50, just: pip install cs50 on your terminal.
  2. To import SQL (sqlite), just write: from cs50 import SQL

And you're all set! Example use case:

from cs50 import SQL
db = SQL("sqlite:///db-name.db")
result = db.execute("SELECT * from table1 WHERE id=1")

Plugging in variables to your SQL query:

result = db.execute("SELECT :column from table1 WHERE name=:name", column="quantity", name="potato");

^ All this is assuming that you have SQLite installed on your machine