Having trouble compiling pysqlite on windows

2019-02-27 02:27发布

Good day.

I am having trouble compiling pysqlite on windows. I have managed to start compiling with quite a bit of work but now I am stuck with this error:

d:/mingw/bin/../lib/gcc/mingw32/4.7.2/../../../../mingw32/bin/ld.exe: cannot find -lsqlite3

I have searched for possible solutions but most of the solutions are for linux.

Please help.

Thank you.

2条回答
对你真心纯属浪费
2楼-- · 2019-02-27 02:59

when compiling pysqlite2 from source, you need to edit the file setup.cfg which by default should look like:

[build_ext]
#define=
#include_dirs=/usr/local/include
#library_dirs=/usr/local/lib
libraries=sqlite3
define=SQLITE_OMIT_LOAD_EXTENSION

You'll need to uncomment include_dirs and library_dirs (remove the #) an make sure include_dirs points to the directory with the sqlite3 headers, and library_dirs to where sqlite3.dll can be found.

Now you should be able to compile and install pysqlite2. After that, you should put sqlite3.dll somwhere it can be found (either somewhere on the PATH, or into Python27\Lib\site-packages\pysqlite2)

查看更多
放我归山
3楼-- · 2019-02-27 03:16

You should be able to use import sqlite3 instead and follow this this tutorial. That worked fine for me when dealing with Sqlite3 in Python. If that package doesn't exist try upgrading your version of Python instead, because that will include other useful packages.

查看更多
登录 后发表回答