hel*_*013 83 python curl pip virtualenv pycurl
我试图使用pip在virtualenv中安装pycurl,我收到了这个错误
ImportError: pycurl: libcurl link-time ssl backend (openssl) is different from compile-time ssl backend (none/other)
Run Code Online (Sandbox Code Playgroud)
我读了一些文档,说"为了解决这个问题,你需要告诉setup.py使用什么SSL后端" (来源),虽然我不知道怎么做,因为我用pip安装了pycurl.
使用pip安装pycurl时如何指定SSL后端?
谢谢
hel*_*013 114
在阅读了他们的INSTALLATION文件后,我能够通过设置环境变量并重新安装来解决我的问题
删除现有pycurl
安装
pip uninstall pycurl
使用链接时ssl后端导出变量(上面是openssl)
export PYCURL_SSL_LIBRARY=openssl
然后,重新安装 pycurl
pip install pycurl --no-cache-dir
可能有其他的解决方案在那里,但这个工程完美的我在virtualenv
和pip
安装.
DrS*_*ork 72
helloworld2013的答案是正确的,但关键是匹配pycurl期望的SSL库.错误将是这样的:
pycurl:libcurl link-time ssl后端(<library>)与编译时ssl后端(<library>或" none/other ")不同
要修复它,你必须使用pycurl所期望的库.在我的情况下,我的错误是" pycurl:libcurl link-time ssl backend(nss)与编译时ssl后端(openssl)不同 ",所以我的修复是:
pip uninstall pycurl
export PYCURL_SSL_LIBRARY=nss
pip install pycurl
Run Code Online (Sandbox Code Playgroud)
Mic*_*son 49
使用OSX 10.13,brew安装的openSSL和virtualenv,我成功地:
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
Run Code Online (Sandbox Code Playgroud)
小智 23
使用pip 7.1,您可以将以下内容放入需求文件中:
pycurl==7.19.5.1 --global-option="--with-nss"
Run Code Online (Sandbox Code Playgroud)
只需用相关的ssl后端库替换nss即可.
Joe*_*ant 19
这对我有用:
pip uninstall pycurl
export PYCURL_SSL_LIBRARY=nss
easy_install pycurl
Run Code Online (Sandbox Code Playgroud)
这些对我都没有用(注意区别就是easy_install vs 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
Run Code Online (Sandbox Code Playgroud)
pal*_*lly 17
在Mac OS High Sierra更新后修复pycurl的方法:
重新安装curl库以使用OpenSSL而不是SecureTransport
brew install curl --with-openssl
Run Code Online (Sandbox Code Playgroud)使用正确的构建时环境和路径安装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
Run Code Online (Sandbox Code Playgroud)我好几天都有这个问题.最后在这里的其他答案的帮助下(主要是亚历山大·泰普科夫),我得到了它为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"
Run Code Online (Sandbox Code Playgroud)
重要提示:请注意,您必须确保使用当前版本的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'
Run Code Online (Sandbox Code Playgroud)
我遇到了这个问题,因为我试图在Elastic Beanstalk中使用Django 1.10配置Celery 4.如果那是你的情况,我写了一篇关于它的完整博客文章.
我在CentOS 7上.我尝试了以上所有内容并且无法正常工作.事实证明我需要以root用户身份运行它们.因此,如果您遇到问题,请以root用户身份尝试上述任何解决方案.举个例子,这对我有用:
su -
pip uninstall pycurl
export PYCURL_SSL_LIBRARY=[nss|openssl|ssl|gnutls]
pip install pycurl
Run Code Online (Sandbox Code Playgroud)
当然,所有关于以root用户身份运行的免责声明均适用.
注意:上面代码中的[nss | openssl | ssl | gnutls]表示选择一个,不包括方括号或管道.问原问题的人会选择openssl.在我的特殊情况下,我选择了nss.您的错误消息应该告诉您要做出哪个选择.
您可以从这里下载tar.gz文件.然后将其提取到一个文件夹中.你会在那里找到一个setup.py文件.运行该站点提到的命令.例如:
python setup.py --with-[ssl|gnutls|nss] install
Run Code Online (Sandbox Code Playgroud)
仅供参考:我试图在我的窗户安装pycurl,但我不能.但是在我的linux上做了.
小智 5
我在 OS X 上运行这个程序,上面的一些解决方案不起作用。与爱德华·纽厄尔的评论类似,该PYCURL_SSL_LIBRARY
变量似乎已被完全忽略。
进一步阅读PycURL 安装文档揭示了以下内容:
pip 可以重新安装之前编译的包,而不是使用新指定的选项重新编译 pycurl
因此,我不得不强制它编译:
pip install --compile pycurl
这适用于很多情况。然而,我确实遇到了一些继续忽略该变量的系统,因此,类似于maharg101 的答案,我求助于安装选项,通过 pip 可以这样设置:
pip install pycurl --global-option="--with-[ssl|gnutls|nss]"
您可以在其中选择方括号内的三个选项之一。请注意,可用选项是ssl
和不是 openssl
。如果您指定,--with-openssl
您将收到错误。另请注意,如果您正在摆弄该PYCURL_SSL_LIBRARY
变量并将其切换为时髦的值以查看会发生什么,则最后一个命令肯定会捕获它并在该值已设置但无效时抛出错误。
对于在 macOS Mojave 上的 PyCharm CE 中遇到问题的任何人,这就是我在 venv 中工作的方式:
归档时间: |
|
查看次数: |
53537 次 |
最近记录: |