使用来自 pi 站点的 debian 映像的全新树莓派。
我用 sudo apt-get install python-pycurl
我的脚本看起来像这样
import pycurl
c = pycurl.Curl()
c.setopt(c.POST, 1)
c.setopt(c.SSL_VERIFYPEER, 1)
c.setopt(c.CAINFO, '/etc/ssl/certs/ca-certificates.crt')
c.setopt(c.URL, 'https://theurl.com')
c.setopt(c.USERPWD, 'user:pass')
c.setopt(c.POSTFIELDS, 'Field1=This&Field2=That')
c.perform()
我得到这个
Traceback (most recent call last):
File "pycurl.py", line 1, in <module>
import pycurl
File "/home/pi/test/pycurl.py", line 3, in <module>
c = pycurl.Curl()
AttributeError: 'module' object has no attribute 'Curl'