在Mac上安装psycopg2出了问题

huangapple go评论84阅读模式
英文:

Trouble installing psycopg2 on Mac

问题

我对开发还很新,并且在尝试在Heroku上部署我的Django项目时遇到了一些错误。我正在尝试使用pip下载django-heroku包,但一直遇到以下错误:

ld: warning: directory not found for option '-L/usr/local/opt/openssl/lib'
ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command '/usr/bin/clang' failed with exit code 1
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for psycopg2
Failed to build psycopg2
ERROR: Could not build wheels for psycopg2, which is required to install pyproject.toml-based projects

我尝试了很多方法,用尽了chatGBT,阅读了很多文章。我尝试重新安装了openssl并使用了以下命令:

export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"

我还尝试安装了psycopg2-binary,这个方法有效,但后来发现安装django-heroku需要psycopg2。我尝试了安装没有依赖项的django-heroku,但仍然需要psycopg2。

我尝试了升级Homebrew、pip、pip设置等等。所有关于这个问题的文章都比较旧了,所以希望能有一些新的见解!我使用的是macOS Ventura 13.4.1。提前感谢您的帮助!

英文:

I'm pretty new to developing and have found some errors while trying to deploy my django project on heroku. I'm trying to download the django-heroku package with pip but keep running into this error:
ld: warning: directory not found for option '-L/usr/local/opt/openssl/lib'
ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command '/usr/bin/clang' failed with exit code 1
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for psycopg2
Failed to build psycopg2
ERROR: Could not build wheels for psycopg2, which is required to install pyproject.toml-based projects

I've tried so many things, exhausted chatGBT, and have read so many articles. I've tried reinstalling openssl and using these commands:
export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"

I've also tried installing psycopg2-binary which worked, only to find that installing django-heroku requires psycog2. I tried installing django-heroku with no dependencies, but it still requires pspycopg2.

I've tried upgrading home-brew, pip, the pip setup, and so much more. All the articles on this are pretty old so some fresh eyes would help! I'm using macOS Ventura 13.4.1. Thanks in advance!

答案1

得分: 1

我问了一位同事,他帮了我一些忙。我有一台M1 Mac,我需要安装Xcode命令行工具来增加对计算机的访问权限。之后,这篇文章对我帮助很大。文章链接:https://stackoverflow.com/questions/26288042/error-installing-psycopg2-library-not-found-for-lssl

英文:

I asked a co-worker and he helped me out a bit. I have an M1 mac and I needed to install xcode command line tools to get more access to my computer. After that, this article helped me a bunch. https://stackoverflow.com/questions/26288042/error-installing-psycopg2-library-not-found-for-lssl

huangapple
  • 本文由 发表于 2023年7月10日 11:31:03
  • 转载请务必保留本文链接:https://go.coder-hub.com/76650538.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定