[python] OpenSSL 사용시 SSL 백엔드 오류

pip를 사용하여 virtualenv에 pycurl을 설치하려고했는데이 오류가 발생했습니다.

ImportError: pycurl: libcurl link-time ssl backend (openssl) is different from compile-time ssl backend (none/other)

내가 말하는 몇 가지 문서를 읽어 “이 문제를 해결하려면, 당신은 무엇 SSL 백엔드를 사용 setup.py 말할 필요” (소스) 내가하지 않도록 내가 주사위를 사용하여 pycurl을 설치하기 때문에이 작업을 수행하는 방법입니다 있지만.

pip로 pycurl을 설치할 때 SSL 백엔드를 어떻게 지정할 수 있습니까?

감사



답변

INSTALLATION 파일을 읽은 후 환경 변수를 설정하여 문제를 해결할 수 있었고 다시 설치했습니다.

  • 기존 pycurl설치 제거

    pip uninstall pycurl

  • 링크 타임 SSL 백엔드로 변수 내보내기 (위의 openssl)

    export PYCURL_SSL_LIBRARY=openssl

  • 다음, 다시는 설치 pycurl전혀 캐시

    pip install pycurl --no-cache-dir

거기에 다른 해결책이있을 수 있지만 이것은 설치 virtualenvpip설치 에서 완벽하게 작동 합니다.


답변

helloworld2013의 대답은 정확하지만 키는 pycurl이 예상하는 SSL 라이브러리와 일치합니다. 오류는 다음과 같습니다.

pycurl : libcurl 링크 타임 SSL 백엔드 ( <library> )가 컴파일 타임 SSL 백엔드 ( <라이브러리> 또는 ” 없음 / 기타 “) 와 다릅니다.

이를 수정하려면 pycurl이 예상하는 라이브러리를 사용해야합니다. 제 경우, 내 오류는 ” pycurl : libcurl link-time ssl backend ( nss ) is different from compile-time ssl backend (openssl) “이므로 수정 사항은 다음과 같습니다.

pip uninstall pycurl
export PYCURL_SSL_LIBRARY=nss
pip install pycurl


답변

양조 설치된 openSSL 및 virtualenv 인 OSX 10.13을 사용하면 다음과 같은 성공을 거두었습니다.

workon ..your-environment-here..
pip uninstall pycurl
export PYCURL_SSL_LIBRARY=openssl
export LDFLAGS=-L/usr/local/opt/openssl/lib;export CPPFLAGS=-I/usr/local/opt/openssl/include;pip install pycurl --compile --no-cache-dir


답변

pip 7.1을 사용하면 요구 사항 파일에 다음을 넣을 수 있습니다.

pycurl==7.19.5.1 --global-option="--with-nss"

nss를 관련 SSL 백엔드 라이브러리로 바꾸면됩니다.


답변

Mac OS High Sierra 업데이트 후 pycurl을 수정하는 방법 :

  1. SecureTransport 대신 OpenSSL을 사용하도록 curl 라이브러리를 다시 설치하십시오.

    brew install curl --with-openssl
    
  2. 올바른 빌드 시간 환경 및 경로로 pycurl 설치

    export PYCURL_SSL_LIBRARY=openssl
    pip uninstall pycurl
    pip install --no-cache-dir --global-option=build_ext --global-option="-L/usr/local/opt/openssl/lib" --global-option="-I/usr/local/opt/openssl/include" --user pycurl
    


답변

이것은 나를 위해 일했습니다.

pip uninstall pycurl
export PYCURL_SSL_LIBRARY=nss
easy_install pycurl

이 중 어느 것도 나를 위해 일하지 않았습니다 (차이점은 단순히 easy_install 대 pip입니다).

pip uninstall pycurl
export PYCURL_SSL_LIBRARY=[nss|openssl|ssl|gnutls]
pip install pycurl
#xor
curl -O https://pypi.python.org/packages/source/p/pycurl/pycurl-7.19.3.1.tar.gz
#...
python setup.py --with-[nss|openssl|ssl|gnutls] install


답변

나는 며칠 동안이 문제가 있었다. 마지막으로 여기에있는 다른 답변 (주로 Alexander Tyapkov의)의 도움으로 AWS Elastic Beanstalk에서 작동하도록했습니다.

수동 설치 (SSH로 연결) :

sudo pip uninstall pycurl
curl -O https://pypi.python.org/packages/source/p/pycurl/pycurl-7.43.0.tar.gz
sudo pip install pycurl-7.43.0.tar.gz --global-option="--with-nss"

중요 : 현재 버전의 Python 및 PIP를 사용하고 있는지 확인해야합니다. 그렇지 않으면 Python 2.x 용으로 컴파일하고 v3.x를 사용할 수 있습니다.

Elastic Beanstalk에 자동 설치 :

files:
  "/usr/local/share/pycurl-7.43.0.tar.gz" :
    mode: "000644"
    owner: root
    group: root
    source: https://pypi.python.org/packages/source/p/pycurl/pycurl-7.43.0.tar.gz

commands:
  01_download_pip3:
    # run this before PIP installs requirements as it needs to be compiled with OpenSSL
    command: 'curl -O https://bootstrap.pypa.io/get-pip.py'
  02_install_pip3:
    # run this before PIP installs requirements as it needs to be compiled with OpenSSL
    command: 'python3 get-pip.py'
  03_pycurl_uninstall:
    # run this before PIP installs requirements as it needs to be compiled with OpenSSL
    command: '/usr/bin/yes | sudo pip uninstall pycurl'
  04_pycurl_download:
    # run this before PIP installs requirements as it needs to be compiled with OpenSSL
    command: 'curl -O https://pypi.python.org/packages/source/p/pycurl/pycurl-7.43.0.tar.gz'
  05_pycurl_reinstall:
    # run this before PIP installs requirements as it needs to be compiled with OpenSSL
    command: 'sudo pip install pycurl-7.43.0.tar.gz --global-option="--with-nss"'

container_commands:
  09_pycurl_reinstall:
    # run this before PIP installs requirements as it needs to be compiled with OpenSSL
    # the upgrade option is because it will run after PIP installs the requirements.txt file.
    # and it needs to be done with the virtual-env activated
    command: 'source /opt/python/run/venv/bin/activate && pip3 install /usr/local/share/pycurl-7.43.0.tar.gz --global-option="--with-nss" --upgrade'

Elastic Beanstalk에서 Django 1.10으로 Celery 4를 구성하려고했기 때문에이 문제가 발생했습니다. 이 경우에 대한 전체 블로그 게시물을 작성했습니다 .