解决pycurl安装失败

隐身守侯 提交于 2020-04-06 09:27:43

现象描述

  1. 现象一:ImportError: pycurl: libcurl link-time ssl backend (openssl) is different from compile-time ssl backend (none/other)
  2. 现象二:
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:

   No module named pycurl

Please install a package which provides this module, or
verify that the module is installed correctly.

It's possible that the above module doesn't match the
current version of Python, which is:
2.7.5 (default, Aug  4 2017, 00:39:18) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-16)]

解决方案

pip uninstall pycurl
# 增加环境变量 
vim /etc/bashrc
export PYCURL_SSL_LIBRARY=openssl
export PYCURL_SSL_LIBRARY=nss
export CPPFLAGS=-I/usr/local/opt/openssl/include
export LDFLAGS=-L/usr/local/opt/openssl/lib
source /etc/bashrc

# 关闭shell,重新进入
# 重新安装pycurl
pip install pycurl==7.43.0 --global-option=build_ext --global-option="-L/usr/local/opt/openssl/lib" --global-option="-I/usr/local/opt/openssl/include" --ignore-installed

参考

https://github.com/transloadit/python-sdk/issues/4

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!