When I run nltk.download ()
, I get an SSL error like this:
$ python3 -c 'import nltk; nltk.download("all")'
[nltk_data] Error loading all: <urlopen error [SSL:
[nltk_data] CERTIFICATE_VERIFY_FAILED] certificate verify failed:
[nltk_data] unable to get local issuer certificate (_ssl.c:1056)>
Save the following with an appropriate file name and execute
import nltk
import ssl
try:
_create_unverified_https_context = ssl._create_unverified_context
except AttributeError:
pass
else:
ssl._create_default_https_context = _create_unverified_https_context
nltk.download()
reference https://stackoverflow.com/a/57954593