我正在尝试
from urllib.request import urlretrieve
url = "https://www.cs.cmu.edu/~./enron/enron_mail_20150507.tgz"
urlretrieve(url, filename="../enron_mail_20150507.tgz")
下载数据集。我收到SSL证书验证失败错误,此问题已解决:ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:749)通过运行
/Applications/Python\ 3.6/Install\ Certificates.command
这给了我一个错误:
-- pip install --upgrade certifi
Collecting certifi
Using cached https://files.pythonhosted.org/packages/56/9d/1d02dd80bc4cd955f98980f28c5ee2200e1209292d5f9e9cc8d030d18655/certifi-2018.10.15-py2.py3-none-any.whl
Installing collected packages: certifi
Found existing installation: certifi 2018.4.16
Uninstalling certifi-2018.4.16:
Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/certifi-2018.4.16.dist-info/DESCRIPTION.rst'
Consider using the `--user` option or check the permissions.
我尝试更改命令代码,但对它进行写保护,所以我认为我不应该对其进行弄乱。所以我跑了
pip install --upgrade certifi
它已更新,但是当我再次尝试下载Enron数据时,我仍然收到相同的消息。似乎该命令已赶上较旧版本的certifi。由于某种原因,我在这台计算机上安装了Python 2.7和3.6,因此我运行pip3
,因为有时可以运行,但仍然遇到相同的错误。