OSX上的psycopg2不安装

发布于 2025-02-11 17:09:45 字数 417 浏览 1 评论 0 原文

关于在OSX上安装Psycopg2的问题有一些问题。

喜欢:

在整理pg_conf之后,仍然与库中的库中陷入困境-lssl

on:

  • osx
  • m1 mac
  • python 3.9

There are a few problems asked about installing psycopg2 on OSX.

Like:

After sorting out pg_conf still stuck with library not found for -lssl

On:

  • OSX
  • M1 Mac
  • Python 3.9

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

没有你我更好 2025-02-18 17:09:45

找到此解决方案,能够使其正常工作,而无需使用 Brew

可悲的是,在安装

  • OpenSSL 蒙特雷12.4
  • Python:3.9.13
  • PIP:22.1.2
  • PSYCOPG2:2.8.5

步骤:

  • 安装libpq: brew brew install install libpq

  • 添加到路径,因此找到了pg_conf,例如:

     导出路径=/opt/opt/homebrew/opt/libpq/bin:$ path
     
  • install openssl: brew install openssl

  • 添加到库路径,例如:

     导出ldflags =“  -  l/opt/opt/homebrew/opt/openssl@3/lib”
    导出cppflags =“  -  i/opt/homebrew/opt/openssl@3/包括”
     
  • pip install psycopg2 == 2.8.5

After finding this solution, was able to make it work without needing the whole of postgres installed, by using brew.

Sadly zlib or openssl are not explained in the install requirements for psycopg2

Verified with:

  • OSX: Monterey 12.4
  • Python: 3.9.13
  • pip: 22.1.2
  • psycopg2: 2.8.5

Steps:

  • Install libpq: brew install libpq

  • Add to path, so pg_conf is found, eg:

    export PATH=/opt/homebrew/opt/libpq/bin:$PATH
    
  • Install openssl: brew install openssl

  • Add to library paths, eg:

    export LDFLAGS="-L/opt/homebrew/opt/openssl@3/lib"
    export CPPFLAGS="-I/opt/homebrew/opt/openssl@3/include"
    
  • pip install psycopg2==2.8.5

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文