Skip to content

Instantly share code, notes, and snippets.

@defulmere
Last active June 25, 2024 01:24
Show Gist options
  • Save defulmere/8b9695e415a44271061cc8e272f3c300 to your computer and use it in GitHub Desktop.
Save defulmere/8b9695e415a44271061cc8e272f3c300 to your computer and use it in GitHub Desktop.
How to override an old sqlite3 module with pysqlite3 in django settings.py
# ⚠️ USE AT YOUR OWN RISK
# first: pip install pysqlite3-binary
# then in settings.py:
# these three lines swap the stdlib sqlite3 lib with the pysqlite3 package
__import__('pysqlite3')
import sys
sys.modules['sqlite3'] = sys.modules.pop('pysqlite3')
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
@sahilgarg231297
Copy link

How to manage updating ~/venv3.10/lib/python3.10/site-packages/chromadb/__init__.py in server running with docker?

@zengyunda
Copy link

这很有帮助,对我也很有用!

当我尝试使用我的 python3.10.8 venv3.10 运行 chromadb 示例代码时出现以下错误: File "~/venv3.10/lib/python3.10/site-packages/chromadb/__init__.py", line 36, in <module> raise RuntimeError( RuntimeError: Your system has an unsupported version of sqlite3. Chroma requires sqlite3 >= 3.35.0.

我执行了以下步骤来解决此错误:

  1. 在我的 python3.10.8 的虚拟环境即 venv3.10 中,使用命令安装了 pysqlite3-binary:pip install pysqlite3-binary
  2. venv3.10/lib/python3.10/site-packages/chromadb/__init__.py在开头添加了以下3行:
__import__('pysqlite3')
import sys
sys.modules['sqlite3'] = sys.modules.pop('pysqlite3')

我的代码运行得非常好!

very good ! 3Q

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment