centos7安裝pycurl
出現錯誤
FileNotFoundError: [Errno 2] No such file or directory: 'curl-config'
ImportError: pycurl: libcurl link-time ssl backend (nss) is different from compile-time ssl backend (openssl)
https://github.com/pycurl/pycurl/pull/353
安裝包解決辦法:
重新安裝以下的庫
centos
yum install libcurl-devel
由於libcurl的源碼編譯因素,在安裝pycurl可能會導致以下兩種錯誤。
錯誤1:
ImportError: pycurl: libcurl link-time ssl backend (openssl) is different from compile-time ssl backend (none/other)
錯誤2:
ImportError: pycurl: libcurl link-time ssl backend (nss) is different from compile-time ssl backend (openssl)
解決辦法:
錯誤1的解決辦法如下:
pip uninstall pycurl
export PYCURL_SSL_LIBRARY=openssl
pip install pycurl
錯誤2的解決辦法如下:
pip uninstall pycurl
export PYCURL_SSL_LIBRARY=nss
pip install pycurl
結果
Installing collected packages: pycurl Running setup.py install for pycurl ... done Successfully installed pycurl-7.43.0.1
源碼解決辦法
wget http://curl.haxx.se/download/curl-7.24.0.tar.gz
tar -zxvf curl-7.24.0.tar.gz
cd curl-7.24.0 ./configure make && make install
安裝pycurl,使用--curl-config=制定curl-config的路徑
wget https://dl.bintray.com/pycurl/pycurl/pycurl-7.43.0.1.tar.gz tar -xzvf pycurl-7.43.0.1.tar.gz cd pycurl-7.43.0.1 python3 setup.py --with-openssl install --curl-config=/usr/local/bin/curl-config
結果
Using /usr/local/bin/curl-config (libcurl 7.24.0) running install running build running build_py creating build ...... Writing /usr/local/python3/lib/python3.6/site-packages/pycurl-7.43.0.1-py3.6.egg-info
安裝成功
