在我的Ubuntu服务器上使用cURL、wget和Python时出现SSL错误

在我的Ubuntu服务器上使用cURL、wget和Python时出现SSL错误,python,python-2.7,ubuntu,ssl,ssl-certificate,Python,Python 2.7,Ubuntu,Ssl,Ssl Certificate,我有一个非常新版本的Lubuntu 19.04运行在我的修补板上,从ELAR系统下载。我想使用Certbot获取SSL证书,这就是我得到Python错误的地方: File "/tmp/tmp.7Ta16YELv4/pipstrap.py", line 177, in <module> sys.exit(main()) File "/tmp/tmp.7Ta16YELv4/pipstrap.py", line 158, in main fo

我有一个非常新版本的Lubuntu 19.04运行在我的修补板上,从ELAR系统下载。我想使用Certbot获取SSL证书,这就是我得到Python错误的地方:

File "/tmp/tmp.7Ta16YELv4/pipstrap.py", line 177, in <module>
  sys.exit(main())
File "/tmp/tmp.7Ta16YELv4/pipstrap.py", line 158, in main
  for path, digest in PACKAGES]
File "/tmp/tmp.7Ta16YELv4/pipstrap.py", line 117, in hashed_download
  response = opener(using_https=parsed_url.scheme == 'https').open(url)
File "/usr/lib/python2.7/urllib2.py", line 429, in open
  response = self._open(req, data)
File "/usr/lib/python2.7/urllib2.py", line 447, in _open
  '_open', req)
File "/usr/lib/python2.7/urllib2.py", line 407, in _call_chain
  result = func(*args)
File "/usr/lib/python2.7/urllib2.py", line 1241, in https_open
  context=self._context)
File "/usr/lib/python2.7/urllib2.py", line 1198, in do_open
  raise URLError(err)
urllib2.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:727)>
卷曲 我检查了文件夹
/usr/share/ca certificates
,它是空的,当我输入
sudo update ca certificates
时,它显示
0 added,0 remove;完成。
。这有什么关系吗


提前谢谢

使用下面的代码段忽略ssl检查

导入ssl

ssl.\u create\u default\u https\u context=ssl.\u create\u unverified\u context

试试这个:
sudo mkdir/usr/local/share/ca certificates/cacert.org&&sudo wget-p/usr/local/share/ca certificates/cacert.orghttp://www.cacert.org/certs/root.crt http://www.cacert.org/certs/class3.crt &&sudo更新ca证书
@IainShelvington哇,谢谢,它解决了我所有的问题:)
tinker@ELAR-Systems:~$ wget stackoverflow.com
--2019-12-29 22:33:53--  http://stackoverflow.com/
Resolving stackoverflow.com (stackoverflow.com)... 151.101.1.69, 151.101.65.69, 151.101.129.69, ...
Connecting to stackoverflow.com (stackoverflow.com)|151.101.1.69|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://stackoverflow.com/ [following]
--2019-12-29 22:33:54--  https://stackoverflow.com/
Connecting to stackoverflow.com (stackoverflow.com)|151.101.1.69|:443... connected.
ERROR: cannot verify stackoverflow.com's certificate, issued by ‘CN=Let's Encrypt Authority X3,O=Let's Encrypt,C=US’:
  Unable to locally verify the issuer's authority.
To connect to stackoverflow.com insecurely, use `--no-check-certificate'.
tinker@ELAR-Systems:~$ curl -X GET -I https://pypi.python.org
curl: (60) SSL certificate problem: unable to get local issuer certificate
More details here: https://curl.haxx.se/docs/sslcerts.html

curl failed to verify the legitimacy of the server and therefore could not
establish a secure connection to it. To learn more about this situation and
how to fix it, please visit the web page mentioned above.