Mac系统无法使用psycopg3?求助解决pango库加载失败问题
解决psycopg3切换时的pango-1.0-0加载错误
针对你的Django 4.2 + Python 3.10 + macOS 14.6环境,尝试以下方案:
重新通过Homebrew安装pango及依赖
brew uninstall --force pango brew install pango配置系统库路径,让Python能识别pango(根据芯片类型选择)
- Intel芯片:
export DYLD_LIBRARY_PATH=/usr/local/lib:$DYLD_LIBRARY_PATH - M系列芯片:
export DYLD_LIBRARY_PATH=/opt/homebrew/lib:$DYLD_LIBRARY_PATH
若要永久生效,可将上述命令添加到
~/.zshrc或~/.bash_profile,然后执行source ~/.zshrc(对应zsh终端)或source ~/.bash_profile(对应bash终端)。- Intel芯片:
重装psycopg3的二进制版本,避免编译依赖问题
pip uninstall -y psycopg3 pip install psycopg3-binary确认Django数据库配置正确
在settings.py的DATABASES配置中,将引擎改为:'ENGINE': 'django.db.backends.postgresql_psycopg3'
内容的提问来源于stack exchange,提问作者Raj
相关产品推荐
相关产品推荐

