You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

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终端)。

  • 重装psycopg3的二进制版本,避免编译依赖问题

    pip uninstall -y psycopg3
    pip install psycopg3-binary
    
  • 确认Django数据库配置正确
    在settings.py的DATABASES配置中,将引擎改为:

    'ENGINE': 'django.db.backends.postgresql_psycopg3'
    

内容的提问来源于stack exchange,提问作者Raj

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.19 19:12:05