Python SQLite: database is locked

后端 未结 20 1167
一生所求
一生所求 2020-12-12 14:24

I\'m trying this code:

import sqlite

connection = sqlite.connect(\'cache.db\')
cur = connection.cursor()
cur.execute(\'\'\'create table item
  (id integer p         


        
20条回答
  •  伪装坚强ぢ
    2020-12-12 14:53

    Oh, your traceback gave it away: you have a version conflict. You have installed some old version of sqlite in your local dist-packages directory when you already have sqlite3 included in your python2.6 distribution and don't need and probably can't use the old sqlite version. First try:

    $ python -c "import sqlite3"
    

    and if that doesn't give you an error, uninstall your dist-package:

    easy_install -mxN sqlite
    

    and then import sqlite3 in your code instead and have fun.

提交回复
热议问题