环境:

操作系统: MacOSX, Ubuntu Python: 2.7

编译sqlcipher

./configure --disable-tcl --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC" LDFLAGS="-lcrypto" --prefix="python_install_path”

修改python 源代码下的setup.py

#sqlite_inc_paths = [ '/usr/include',
#                     '/usr/include/sqlite',
#                     '/usr/include/sqlite3',
#                     '/usr/local/include',
#                     '/usr/local/include/sqlite',
#                     '/usr/local/include/sqlite3',
#                   ]
sqlite_inc_paths = [ '/opt/recro_qtapp/include/sqlcipher',
]

#        for d_ in inc_dirs + sqlite_inc_paths:
        for d_ in sqlite_inc_paths:

#             sqlite_dirs_to_check = [
#                 os.path.join(sqlite_incdir, '..', 'lib64'),
#                 os.path.join(sqlite_incdir, '..', 'lib'),
#                 os.path.join(sqlite_incdir, '..', '..', 'lib64'),
#                 os.path.join(sqlite_incdir, '..', '..', 'lib'),
#             ]


sqlite_dirs_to_check = [
                os.path.join(sqlite_incdir, '..', '..', 'lib'),
]


sqlite_libfile = self.compiler.find_library_file(
#                           sqlite_dirs_to_check + lib_dirs, 'sqlite3')
                            sqlite_dirs_to_check + lib_dirs, 'sqlcipher')


    exts.append(Extension('_sqlite3', sqlite_srcs,
                          define_macros=sqlite_defines,
                          include_dirs=["Modules/_sqlite",
                                        sqlite_incdir],
                          library_dirs=sqlite_libdir,
                          runtime_library_dirs=sqlite_libdir,
                          extra_link_args=sqlite_extra_link_args,
                          #libraries=["sqlite3",]))
                          libraries=["sqlcipher",]))