解决方法:with sqlite3.connect(dbfile) as con: con.enable_load_extension(True) con.execute("SELECT load_extension('mod_spatialite')") cursor = con.cursor() cursor.execute("select InitSpatialMetaData(1);")