Python visual studio代码中是否有SSL错误的修复程序?
我是一名学习python的学生,我正在从网页中提取信息。如果我试着运行这个程序,从一个实时地震反馈中提取信息,我会得到一个SSL错误(下面有更详细的说明)。我所知道的代码没有错误,因为我正在跟随一位老师学习一门在线课程 我已尝试运行installcertificates命令和updateshell Profile命令,两者都不起作用。我正在用python 3.7.2编写visual studio代码,我也在Mac上。我得到的错误代码如下: 发生异常:Python visual studio代码中是否有SSL错误的修复程序?,python,python-3.x,python-2.7,ssl,Python,Python 3.x,Python 2.7,Ssl,我是一名学习python的学生,我正在从网页中提取信息。如果我试着运行这个程序,从一个实时地震反馈中提取信息,我会得到一个SSL错误(下面有更详细的说明)。我所知道的代码没有错误,因为我正在跟随一位老师学习一门在线课程 我已尝试运行installcertificates命令和updateshell Profile命令,两者都不起作用。我正在用python 3.7.2编写visual studio代码,我也在Mac上。我得到的错误代码如下: 发生异常:错误 dou open中的文件“/Librar
错误
dou open中的文件“/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py”,第1319行
引发URL错误(err)
https_open中的文件“/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py”,第1360行
上下文=self.\u上下文,检查主机名=self.\u检查主机名)
文件“/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py”,第503行,在调用链中
结果=func(*args)
文件“/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py”,第543行,打开
"开放",
文件“/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py”,第525行,打开
响应=自身打开(请求,数据)
http_error_302第755行的文件“/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py”
返回self.parent.open(新建,超时=请求超时)
文件“/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py”,第503行,在调用链中
结果=func(*args)
文件“/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py”,第563行出错
结果=自身调用链(*args)
http_响应中的文件“/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py”,第641行
“http”、请求、响应、代码、消息、hdrs)
打开文件“/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py”,第531行
响应=方法(请求,响应)
urlopen中的文件“/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py”,第222行
我在终端上也收到了这样的信息:
由于环境错误而无法安装程序包:[Errno 13]权限被拒绝:'/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/certifi-2019.3.9.dist-info'
考虑使用“-Upple”选项或检查权限。
您使用的是pip版本18.1,但版本19.0.3可用。
您应该考虑通过“PIP安装升级PIP”命令进行升级。
我试着把它输入终端,它说找不到命令。我正在使用学校的电脑,所以某些东西被屏蔽了,也许这是问题的一部分,我真的不知道。这是我的密码:
import urllib.request
import json
def printResults(data):
theJSON = json.loads(data)
if "title" in theJSON["metadata"]:
print(theJSON["metadata"]["title"])
count = theJSON["metadata"]["count"]
print (str(count) + " events recorded")
def main():
urlData = "http://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/2.5_day.geojson"
webUrl = urllib.request.urlopen(urlData)
print ("result code: " + str(webUrl.getcode()))
if (webUrl.getcode() == 200):
data = webUrl.read()
printResults(data)
else:
print("Received error, cannot parse results")
if __name__ == "__main__":
main()
如果你有一个解决方案,记得我是计算机科学第一学期的学生,所以请简单解释一下