urllib2.URLError: urlopen error [Errno -3] Temporary failure in name resolution

>>> sd = load_url("https://s3-us-west-2.amazonaws.com/jcjohns-models/vgg16-00b39a1b.pth")
Downloading: "https://s3-us-west-2.amazonaws.com/jcjohns-models/vgg16-00b39a1b.pth" to /home/ubuntu/.torch/models/vgg16-00b39a1b.pth
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/local/lib/python2.7/dist-packages/torch/utils/model_zoo.py", line 65, in load_url
    _download_url_to_file(url, cached_file, hash_prefix, progress=progress)
  File "/usr/local/lib/python2.7/dist-packages/torch/utils/model_zoo.py", line 75, in _download_url_to_file
    u = urlopen(url)
  File "/usr/lib/python2.7/urllib2.py", line 154, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python2.7/urllib2.py", line 429, in open
    response = self._open(req, data)
  File "/usr/lib/python2.7/urllib2.py", line 447, in _open
    '_open', req)
  File "/usr/lib/python2.7/urllib2.py", line 407, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.7/urllib2.py", line 1241, in https_open
    context=self._context)
  File "/usr/lib/python2.7/urllib2.py", line 1198, in do_open
    raise URLError(err)
urllib2.URLError: 

问题原因:问题发生在部署WSCL时,未能解析目标网站的DNS服务器
解决方案:添加DNS服务器配置信息

  • 打开配置文件
    sudo gedit /etc/resolv.con

  • 将下列内容添加到文件中

    #nameserver 127.0.0.1这行是打开文件时候就有的,无需改动
    nameserver 8.8.8.8
    nameserver 114.114.114.114

你可能感兴趣的:(Ubuntu)