小编Han*_*nna的帖子

在 M1 mac 上导入 psycopg2 时出错:架构不兼容

当我尝试导入 psycopg2 时,收到以下错误消息:

ImportError: dlopen(/opt/homebrew/lib/python3.10/site-packages/psycopg2/_psycopg.cpython-310-darwin.so, 0x0002): Library not loaded: /opt/homebrew/opt/postgresql/lib/libpq.5.dylib
  Referenced from: /opt/homebrew/lib/python3.10/site-packages/psycopg2/_psycopg.cpython-310-darwin.so
  Reason: tried: '/opt/homebrew/opt/postgresql/lib/libpq.5.dylib' (no such file), '/usr/local/lib/libpq.5.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')), '/usr/lib/libpq.5.dylib' (no such file), '/opt/homebrew/Cellar/postgresql@14/14.5_3/lib/libpq.5.dylib' (no such file), '/usr/local/lib/libpq.5.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')), '/usr/lib/libpq.5.dylib' (no such file)
Run Code Online (Sandbox Code Playgroud)

有谁知道如何解决这个错误?

python macos psycopg2 apple-m1

8
推荐指数
2
解决办法
7107
查看次数

标签 统计

apple-m1 ×1

macos ×1

psycopg2 ×1

python ×1