我正在尝试通过pip下载一些包(目前是google )--但是我得到了这样的响应:
pi@raspberrypi ~ $ sudo easy_install google-api-python-client
Searching for google-api-python-client
Best match: google-api-python-client 1.3.1
Processing google_api_python_client-1.3.1-py2.7.egg
google-api-python-client 1.3.1 is already the active version in easy-install.pth
Using /usr/local/lib/python2.7/dist-packages/google_api_python_client-1.3.1-py2.7.egg
Processing dependencies for google-api-python-client
Searching for uritemplate>=0.6
Reading http://pypi.python.org/simple/uritemplate/
Download error on http://pypi.python.org/simple/uritemplate/: [Errno -5] No address associated with hostname -- Some packages may not be found!
Reading http://pypi.python.org/simple/uritemplate/
Download error on http://pypi.python.org/simple/uritemplate/: [Errno -5] No address associated with hostname -- Some packages may not be found!
Couldn't find index page for 'uritemplate' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading http://pypi.python.org/simple/
Download error on http://pypi.python.org/simple/: [Errno -5] No address associated with hostname -- Some packages may not be found!
No local packages or download links found for uritemplate>=0.6
error: Could not find suitable distribution for Requirement.parse('uritemplate>=0.6')现在,我想我应该在这里问,而不是在RPi.SE上,因为这里似乎已经问了好几次了。现在,通常情况下,这将不构成再次要求-但这些解决方案都没有帮助。
我看过了
举几个例子。
这些解决方案中有几个提到了导致此错误的代理问题--但是,这不是我的问题,因为我没有代理,而且我的$http_proxy是空的:
pi@raspberrypi ~ $ echo $http_proxy
pi@raspberrypi ~ $ 提到的另一个问题是缺乏适当的SSL版本,所给出的解决方案是安装看起来有点过时的pip 1.2.1...now。我需要安装OpenSSL/pip的某个版本吗?
我确实安装了pip1.2.1,之前有1.1.1 (来自Raspbian存储库的包),但也有相同的错误。
知道是什么导致了这一切吗?
编辑:这是HTTPLib错误吗?
我认为这是我的Raspberry上的Python安装中的一个问题,因为我正在使用httplib python库在我的其他代码中获得相同的错误(httplib)。httplib库中的一个问题肯定会解释这个问题。
注意,curl、wget和lynx都工作得很好。
发布于 2015-01-05 22:42:53
按照这篇文章发表在Raspberry Pi论坛上的说法,我解决了这个问题。
我必须编辑create_connection()文件中的/usr/lib/python2.7/socket.py函数,以便首先将主机名解析为IP:
原始代码:
def create_connection(.....)
host, port = address
err = None
for res in getaddrinfo(host, port, 0, SOCK_STREAM):编辑代码:
def create_connection(.....)
host, port = address
err = None
hostip = gethostbyname(host)
for res in getaddrinfo(hostip, port, 0, SOCK_STREAM):https://stackoverflow.com/questions/27758275
复制相似问题