python3安裝pycurl

centos7安裝pycurlcss

出現錯誤python

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/353git

安裝包解決辦法:
從新安裝如下的庫
centosgithub

yum install libcurl-develcentos

因爲libcurl的源碼編譯因素,在安裝pycurl可能會致使如下兩種錯誤。ruby

錯誤1:bash

ImportError: pycurl: libcurl link-time ssl backend (openssl) is different from compile-time ssl backend (none/other)curl

錯誤2:ui

ImportError: pycurl: libcurl link-time ssl backend (nss) is different from compile-time ssl backend (openssl)url

解決辦法:

錯誤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 

安裝成功

相關文章
相關標籤/搜索