gpt4 book ai didi

Tensorflow 中的 Python SSL 认证问题

转载 作者:行者123 更新时间:2023-11-28 22:23:43 24 4
gpt4 key购买 nike

我正在尝试下载据称在以下位置处理的 MNIST 数据:

tensorflow.examples.tutorials.mnist.input_data.read_data_sets()

据我所知,read_data_sets 向服务器发送拉取请求以下载(大约)1.5GB 的数据。

我不断收到此回溯错误:

File
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py",
line 1318, in do_open
encode_chunked=req.has_header('Transfer-encoding')) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py",
line 1239, in request
self._send_request(method, url, body, headers, encode_chunked) File
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py",
line 1285, in _send_request
self.endheaders(body, encode_chunked=encode_chunked) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py",
line 1234, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked) File
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py",
line 1026, in _send_output
self.send(msg) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py",
line 964, in send
self.connect() File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py",
line 1400, in connect
server_hostname=server_hostname) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py",
line 401, in wrap_socket
_context=self, _session=session) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py",
line 808, in __init__
self.do_handshake() File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py",
line 1061, in do_handshake
self._sslobj.do_handshake() File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py",
line 683, in do_handshake
self._sslobj.do_handshake() ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:748)

它显然与 Python 使用的 SSL 证书有关...所以我转到/Applications/Python 3.6/并执行位于那里的“Install Certifactions.command”并收到此错误:

Traceback (most recent call last):   File
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/shutil.py",
line 544, in move
os.rename(src, real_dst) PermissionError: [Errno 13] Permission denied:
'/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/certifi-2015.04.28.dist-info/DESCRIPTION.rst'
-'/var/folders/mq/g_jy_1qx1vjdb3xmdh7y62y80000gn/T/pip-3m8ixnf5-uninstall/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/certifi-2015.04.28.dist-info/DESCRIPTION.rst'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/basecommand.py",
line 215, in main
status = self.run(options, args) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/commands/install.py",
line 342, in run
prefix=options.prefix_path, File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/req/req_set.py",
line 778, in install
requirement.uninstall(auto_confirm=True) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/req/req_install.py",
line 754, in uninstall
paths_to_remove.remove(auto_confirm) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/req/req_uninstall.py",
line 115, in remove
renames(path, new_path) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/utils/__init__.py",
line 267, in renames
shutil.move(old, new) File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/shutil.py",
line 559, in move
os.unlink(src) PermissionError: [Errno 13] Permission denied: '/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/certifi-2015.04.28.dist-info/DESCRIPTION.rst'

我的文件系统权限有问题吗?大约一个月前,我确实在这台计算机上重新安装了 OSX...

有没有办法手动安装证书?或者发出拉取请求将数据下载到非 https 地址?

最佳答案

安装证书,双击 /Applications/Python 3.6/Install Certificates.command 中的文件(在 macOS 上),或从 bash 终端运行此命令:

/Applications/Python\ 3.6/Install\ Certificates.command

现在安装了证书以通过 HTTPS 下载数据。

来源:dedicated issue on TensorFlow GitHub for official models .

关于Tensorflow 中的 Python SSL 认证问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46858630/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com