socket.gaierror: [Errno -3] Temporary failure in name resolution

此处是因为localhost.localdomain无法解析造成的,此时修改/etc/hosts,添加如下行解决

127.0.0.1       localhost.localdomain localhost
Temporary failure in name resolution 错误解决方法:
vim /etc/resolv.conf

'添加了两行(DNS地址是咨询了服务器运营商得知的)'
nameserver   202.96.209.133
nameserver   61.129.88.123
nameserver 114.114.114.114
运行sudo 命令 can not resovle host xxx 错误解决方法:
vim /etc/hosts
127.0.0.1 localhost
127.0.0.1 <your hostname>

cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

192.168.128.40 dev-nn001
cat /etc/hostname
prd-spider002

参考:https://blog.csdn.net/feiying00544/article/details/83113460
https://blog.csdn.net/zeli1511/article/details/80362632
http://lax.v2ex.com/t/462728

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐