Python3程序执行失败并出现错误:' socket.gaierror:[Errno -2]名称或服务未知'

时间:2016-02-26 12:32:12

标签: python urllib3

我正在使用python virtualenv运行python3程序。 我在代理后面并在执行下面的程序之前导出了http_proxy / https_proxy。仍然遇到问题。请建议。

(geo_env)root@xyz-ntp-154:~/geo_env# cat search1.py
#!/usr/bin/env python3

from pygeocoder import Geocoder

if __name__ == '__main__':
    address = '207 N. Defiance St, Archbold, OH'
    print(Geocoder.geocode(address)[0].coordinates)

这是错误:

(geo_env)root@xyz-ntp-154:~/geo_env# python3 search1.py
Traceback (most recent call last):
File "/root/geo_env/lib/python3.4/site-    packages/requests/packages/urllib3/connection.py", line 137, in _new_conn
(self.host, self.port), self.timeout, **extra_kw)
File "/root/geo_env/lib/python3.4/site-  packages/requests/packages/urllib3/util/connection.py", line 67, in create_connection
for res in socket.getaddrinfo(host, port, 0, socket.SOCK_STREAM):
File "/usr/lib/python3.4/socket.py", line 533, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known

0 个答案:

没有答案