VeighNa量化社区
你的开源社区量化交易平台
Member
avatar
加入于:
帖子: 3
声望: 0

File "....\envs\vnpy\Lib\site-packages\peewee.py", line 3327, in _connect
raise ImproperlyConfigured('SQLite driver not installed!')

peewee.ImproperlyConfigured: SQLite driver not installed!

但是如果命令行方式运行,是可以正常运行的。界面可以正常呈现。

Administrator
avatar
加入于:
帖子: 4500
声望: 320

这说明你的机器可能安装了多套Python环境,VSCode中运行用的是某套没装sqlite的

Member
avatar
加入于:
帖子: 3
声望: 0

谢谢群主。

本机安装了anaconda,单独建了一个名字叫vnpy的conda环境。
activate vnpy,用python run.py就可以正常运行。
用vs或者wingide打开项目,项目环境也设置成vnpy这个conda环境就出问题,怪了。
看了下peewee代码,有这么一段

try:
    from pysqlite3 import dbapi2 as pysq3
except ImportError:
    try:
        from pysqlite2 import dbapi2 as pysq3
    except ImportError:
        pysq3 = None
try:
    import sqlite3
except ImportError:
    sqlite3 = pysq3
else:
    if pysq3 and pysq3.sqlite_version_info >= sqlite3.sqlite_version_info:
        sqlite3 = pysq3

然后我又去pip装这个pysqlite3。安装的时候报错。
Building wheels for collected packages: pysqlite3
Building wheel for pysqlite3 (setup.py) ... done
WARNING: Legacy build of wheel for 'pysqlite3' created no files.
Command arguments: 'C:\Users\86156\AppData\Local\conda\conda\envs\vnpy\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\86156\AppData\Local\Temp\pip-install-c73jt2vi\pysqlite3\setup.py'"'"'; file='"'"'C:\Users\86156\AppData\Local\Temp\pip-install-c73jt2vi\pysqlite3\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\86156\AppData\Local\Temp\pip-wheel-lnh338_6' --python-tag cp37
Command output: [use --verbose to show]
Running setup.py clean for pysqlite3
Failed to build pysqlite3
Installing collected packages: pysqlite3
Running setup.py install for pysqlite3 ... done
Successfully installed pysqlite3

可能是哪块版本不匹配有问题,我再找找。

Member
avatar
加入于:
帖子: 3
声望: 0

最后在conda的vnpy环境的目录的dll复制进去了sqlite3.def sqlite3.dll文件,peewee就能正常加载了。

© 2015-2022 上海韦纳软件科技有限公司
备案服务号:沪ICP备18006526号

沪公网安备 31011502017034号

【用户协议】
【隐私政策】
【免责条款】