我正在尝试运行
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) by running
/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
它更新了,但是当我再次尝试下载安然数据时,我仍然收到相同的消息。似乎该命令被旧版本的 certifi 赶上了。出于某种原因,我在这台计算机上安装了 Python 2.7 和 3.6,所以我跑了pip3
,因为有时它可以工作,但仍然遇到同样的错误。