现象描述
- 现象一:ImportError: pycurl: libcurl link-time ssl backend (openssl) is different from compile-time ssl backend (none/other)
- 现象二:
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
来源:oschina
链接:https://my.oschina.net/csp277/blog/3217065