How to work with sqlite3 and Python

前端 未结 4 553
刺人心
刺人心 2021-01-20 21:50

I was looking for any database solution with Python. And found the tutorial Python: A Simple Step-by-Step SQLite Tutorial. There I found a code example which shows how to cr

4条回答
  •  抹茶落季
    2021-01-20 22:22

    For clarification, and as seen in the reference tutorial. "Python gained the sqlite3 module all the way back in version 2.5 which means that you can create SQLite database with any current Python without downloading any additional dependencies." The documentation is available at https://docs.python.org/2/library/sqlite3.html

    I was searching this question, since I was completing the 'install_requires' section of my setup.py and wanted to make sure sqlite3 was included.

    I noticed on Macports, I needed to explicitly install sqlite3 and py27-sqlite.

    A simple way to test your version.

    >>> import sqlite3
    >>> sqlite3.version
    '2.6.0'
    

    or whatever version installed will show up, or you will get an ImportError if it is not installed.

    With some quick searches of pysqlite you can find some options for older versions of sqlite.

提交回复
热议问题