pythonurllib2错误在PC上有效,但在raspberrypi上不起作用

2024-09-29 11:24:04 发布

您现在位置:Python中文网/ 问答频道 /正文

嗨,我一直在尝试在raspberry pi上执行下面的python代码,但是遇到了一个在我的PC上不存在的错误

import urllib2
response = urllib2.urlopen('http://pythonforbeginners.com/')
print response.info()
html = response.read()
# do something
response.close()  

错误如下,但我不明白这里出了什么问题,有人能解释一下发生了什么吗?我已经在pi中安装了urllib2:

^{pr2}$

Tags: 代码importinfocomhttpresponsehtml错误