1. 问题现象
Ubuntu 机器或者 Docker 容器报错
Traceback (most recent call last):
File "main.py", line 200, in <module>
File "attribute_extract/extract_attribute.py", line 37, in __init__
File "attribute_extract/models.py", line 25, in __init__
File "torchvision/models/resnet.py", line 199, in resnet50
File "torch/hub.py", line 433, in load_state_dict_from_url
File "torch/hub.py", line 349, in _download_url_to_file
File "urllib/request.py", line 162, in urlopen
File "urllib/request.py", line 465, in open
File "urllib/request.py", line 483, in _open
File "urllib/request.py", line 443, in _call_chain
File "urllib/request.py", line 1286, in https_open
File "urllib/request.py", line 1245, in do_open
urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:645)>
2. 解决方案
sudo apt-get update
sudo apt-get install ca-certificates
sudo update-ca-certificates --fresh
export SSL_CERT_DIR=/etc/ssl/certs
|