python error: curl: (1) Protocol "'https" not supported or disabled in libcurl

來源:互聯網
上載者:User

標籤:解決   出現   print   arch   conf   support   需要   protoc   libc   

 

python 調用curl訪問一個網頁時,出現error: curl: (1) Protocol "‘https" not supported or disabled in libcurl

控制台直接curl xxx是ok的

output = subprocess.check_output(["curl","https://stackoverflow.com/questions/6884669/curl-1-protocol-https-not-supported-or-disabled-in-libcurl"]) # errorprint(output)

 這邊有一個解決方案,但是對此並沒有解決問題,原來是雙引號的問題,換成但引號就解決問題了,一直以為但引號雙引號都能表示字串,具體為什麼還不是很清楚,但是能解決問題了,需要深入再去瞭解下,如知請告訴我下

output = subprocess.check_output(["curl",‘https://stackoverflow.com/questions/6884669/curl-1-protocol-https-not-supported-or-disabled-in-libcurl’]) # okprint(output)

 看demo也是單引號,curl支援但引號嗎? 測試了下 pycurl都支援 但引號雙引號一樣

import pycurlc = pycurl.Curl()c.setopt(c.URL, ‘https://www.taobao.com‘)c.perform()

 

另外該error:

可能其他原因:

1、curl 不支援https  可以用curl -V 查看

對應解決方案是重新安裝curl  可參考:http://www.codeweblog.com/curl%e4%b8%8d%e6%94%af%e6%8c%81https%e5%8d%8f%e8%ae%ae%e9%97%ae%e9%a2%98%e8%a7%a3%e5%86%b3/

wget http://archive.ubuntu.com/ubuntu/pool/main/c/curl/curl_7.35.0.orig.tar.gztar -xzvf curl_7.35.0.orig.tar.gzcd curl_7.35.0.orig./configuremakesudo make install

 2、引號內有空格 “ https”

python error: curl: (1) Protocol "'https" not supported or disabled in libcurl

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.