psycopg2 설치 오류, -lssl에 대한 라이브러리를 찾을 수 없음
"sudo pip install psycopg2"를 실행하면 다음과 같은 출력이 나타납니다.
cc -DNDEBUG -g -fwrapv -Os .....
.....
cc -DNDEBUG -g -fwrapv -Os .....
.....
그리고 마지막에는 다음과 같이 말합니다.
ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'cc' failed with exit status 1
----------------------------------------
Cleaning up...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/private/var/folders/bz/pvj1g9xj16d10pjjgbrfl3fw0000gn/T/pip_build_root/psycopg2/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/bz/pvj1g9xj16d10pjjgbrfl3fw0000gn/T/pip-uE3thn-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /private/var/folders/bz/pvj1g9xj16d10pjjgbrfl3fw0000gn/T/pip_build_root/psycopg2
Storing debug log for failure in /Users/Tyler/Library/Logs/pip.log
easy_install을 실행 하거나 소스 에서 수행하면 끝에 동일한 오류가 발생합니다 (-lssl에 대한 라이브러리를 찾을 수 없음).
양조 설치 (또는 업그레이드) openssl을 실행하면 다음과 같은 결과가 나타납니다.
$ brew upgrade openssl
Error: openssl-1.0.1h already installed
누구든지 나를 도울 수 있습니까?
macOS Sierra 10.12에서 이에 대한 솔루션을 찾는 모든 사람 : 명령 줄 도구를 설치하여이 문제를 해결했습니다.
xcode-select --install
그 후에 pip install psycopg2
작동합니다.
그렇지 않은 경우 brew의 openssl에 대해 링크를 시도 할 수도 있습니다.
env LDFLAGS="-I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib" pip install psycopg2
brew를 통해 설치된 openssl과 함께. (가) 있습니다 brew link openssl --force
더 이상 작동하지 않습니다
$ brew link openssl --force 17.5s
Warning: Refusing to link: openssl
Linking keg-only openssl means you may end up linking against the insecure,
deprecated system OpenSSL while using the headers from Homebrew's openssl.
Instead, pass the full include/library paths to your compiler e.g.:
-I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib
@macho가 여전히 작동하지 않으면 아래에서 지적했듯이 --no-cache
pip 옵션 을 사용해야 할 수도 있습니다.
env LDFLAGS="-I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib" pip --no-cache install psycopg2
실행할 때 brew link openssl
다음 메시지가 나타납니다.
$ brew link openssl
Warning: Refusing to link: openssl
Linking keg-only openssl means you may end up linking against the insecure,
deprecated system OpenSSL while using the headers from Homebrew's openssl.
Instead, pass the full include/library paths to your compiler e.g.:
-I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib
이 조언에 따라 pip
사용해야 하는 명령 은 다음과 같습니다 .
$ pip install -r requirements.txt --global-option=build_ext --global-option="-I/usr/local/opt/openssl/include" --global-option="-L/usr/local/opt/openssl/lib"
Brew ( brew install openssl
) 에서 OpenSSL을 설치했습니다.
다음은 나를 위해 일했습니다.
export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"
pip install psycopg2
나를 위해 일한 것은 openssl을 연결하는 명령에 제공된 힌트였습니다.
$ brew link openssl
Warning: Refusing to link macOS-provided software: openssl
If you need to have openssl first in your PATH run:
echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.zshrc
For compilers to find openssl you may need to set:
export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"
$ export LDFLAGS="-L/usr/local/opt/openssl/lib"
$ export CPPFLAGS="-I/usr/local/opt/openssl/include"
$ pip install psycopg2
Collecting psycopg2
Using cached https://files.pythonhosted.org/packages/23/7e/93c325482c328619870b6cd09370f6dbe1148283daca65115cd63642e60f/psycopg2-2.8.2.tar.gz
Installing collected packages: psycopg2
Running setup.py install for psycopg2 ... done
Successfully installed psycopg2-2.8.2
mojave에서 나는 이것을 .bash_profile에 추가했습니다.
export PATH="/usr/local/opt/openssl/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/curl/lib -L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/curl/include -I/user/local/opt/openssl/include"
그런 다음 파이썬 3.7.4 virtualenv에 psycopg 2.8.3을 설치할 수있었습니다.
xcode 및 명령 줄 도구를 다시 설치 한 후.
위의 모든 답변이 도움이되었습니다!
최근에 Virtualenv에 Python 3.7을 설치 한 High Sierra에서이 문제가 발생했습니다.
해결책은 psycopg2의 최신 버전을 사용하는 것입니다. 버전 2.7.7은 작동했지만 2.7.1은 작동하지 않았습니다.
Using Fish, the following two commands solved this issue for me after install OpenSSL using Homebrew.
set -gx LDFLAGS "-L/usr/local/opt/openssl/lib"
set -gx CPPFLAGS "-I/usr/local/opt/openssl/include"
Use brew info openssl
to get up-to-date info.
Instead of installing psycopg2
, install psycopg2-binary
, from the same authors:
pip install psycopg2-binary
This is what the documentation says about this PyPI package:
You can [...] obtain a stand-alone package, not requiring a compiler or external libraries, by installing the psycopg2-binary package from PyPI:
$ pip install psycopg2-binary
The binary package is a practical choice for development and testing but in production it is advised to use the package built from sources.
I was having this issue on Mojave. Mojave does not create a /usr/include directory, which psycopg2 needs to install. This was not obvious. I found the solution here: How to update Xcode from command line, which references: https://forums.developer.apple.com/thread/104296
This's the problem of new macOs version, where pip cannot install cryptography
. What fixed my problem is to provide the env to the install command:
brew install openssl
env LDFLAGS="-L$(brew --prefix openssl)/lib" CFLAGS="-I$(brew --prefix openssl)/include" <YOUR COMMAND HERE>
You can replace <YOUR COMMAND HERE>
with pip install cryptography
, or pip install <SOMETHING THAT REQUIRES cryptography>
for example.
Credit to this article: Fixing macOS Sierra fatal error: 'openssl/opensslv.h' or 'openssl/aes.h' file not found
I've managed to fix it by using:
brew unlink openssl && brew link openssl --force
I am not sure how this differs from the brew uninstall/upgrades that I did on OpenSSL in prior attempts I've made. My assumption is that these operations left some of the "faulty" shared libraries which were preventing this from working. Note that this also fixed issues with installing python cryptography module.
참고URL : https://stackoverflow.com/questions/26288042/error-installing-psycopg2-library-not-found-for-lssl
'program tip' 카테고리의 다른 글
다른 해상도 지원 안드로이드 (0) | 2020.10.11 |
---|---|
파일에서 단일 속성 (예 : ReadOnly)을 제거하는 방법은 무엇입니까? (0) | 2020.10.11 |
이름이 점 ( ".")으로 끝나는 폴더를 삭제하는 방법은 무엇입니까? (0) | 2020.10.11 |
jquery-ui datepicker 변경 Z- 색인 (0) | 2020.10.11 |
'auto'키워드를 명시 적으로 작성해야하는 이유는 무엇입니까? (0) | 2020.10.11 |