【发布时间】:2023-04-26 06:32:01
【问题描述】:
我在 AWS 中有一个运行 Python3.6 (Amazon Linux/2.8.3) 的 ec2 实例,其中我需要安装带有 NSS ssl 后端的 pycurl。
首先我尝试将pycurl==7.43.0 --global-option="--with-nss" 添加到我的requirement.txt 文件中,但我收到错误安装错误。所以我最终通过在.ebextensions 中添加一个.config 文件(在部署期间运行)来做到这一点:
container_commands:
09_pycurl_reinstall:
# 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 && PYCURL_SSL_LIBRARY=nss pip3 install pycurl --global-option="--with-nss" --upgrade --no-cache-dir --compile --ignore-installed'
Pycurl 似乎安装正确,但是 celery worker 没有运行。芹菜工人日志显示:
__main__.ConfigurationError: Could not run curl-config: [Errno 2] No such file or directory
如果我 ssh 连接到实例并运行 python 3.6 -c 'import pycurl',我会收到更详细的错误:
ImportError: pycurl: libcurl link-time ssl backend (openssl) is different from compile-time ssl backend (nss)
所以我想我的问题是我之前使用 openSSL 而不是 NSS 安装了 libcurl,因此 libcurl 和 pycurl 之间不匹配。
根据另一个 * 问题,对于要与 NSS 后端一起安装的 libcurl,我应该安装它:
sudo apt libcurl4-nss-dev
但由于服务器运行的是 Amazon Linux,我无法使用 apt 命令。所以我改为:
yum install libcurl-devel
我想这就是问题所在:当我需要 NSS 支持时,它会安装带有 OpenSSL 支持的 libcurl。
如何在 Amazon Linux 中安装带有 NSS 的 libcurl??(我需要 NSS,因为我使用 SQS 作为代理运行带有 celery 的 Django 应用程序,而 SQS 需要 NSS)。 p>
非常感谢!
【问题讨论】:
-
我和你有几乎相同的堆栈(从其他问题中看到):Django / SQS / Celery / Beanstalk。我让它运行起来,也遇到了 pycurl 的问题,但我使用了 openssl。我不认为 SQS 需要 nss,至少对我而言,openssl 在 Amazon Linux 2.8.6 上与 Python 3.6 配合得很好。
-
是的,我最终使用了 openssl,它运行良好。我不知道为什么我认为 SQS 需要 nss。还是谢谢!
标签: python amazon-web-services amazon-ec2 libcurl pycurl