我使用pythonbrew在Snow Leopard上安装Python 2.6.6。它失败了一个readline错误,然后是一个套接字错误。我安装源,这使得在下次尝试安装快乐的ReadLine,但套接字错误仍然存在:由于test_socket无法解决,导致Pythonbrew失败的解决方法?
test_socket test test_socket failed -- Traceback (most recent call last): File "/Users/gferguson/python/pythonbrew/build/Python-2.6.6/Lib/test/test_socket.py", line 483, in testSockName my_ip_addr = socket.gethostbyname(socket.gethostname()) gaierror: [Errno 8] nodename nor servname provided, or not known
与系统的Python显示周围挖:
>>> import socket >>> my_ip_addr = socket.gethostbyname(socket.gethostname()) Traceback (most recent call last): File "", line 1, in socket.gaierror: [Errno 8] nodename nor servname provided, or not known >>> socket.gethostname() 'S1WSMA-JHAMI' >>> socket.gethostbyname('S1WSMA-JHAMI') Traceback (most recent call last): File "", line 1, in socket.gaierror: [Errno 8] nodename nor servname provided, or not known >>> socket.gethostbyname('google.com') '74.125.227.20'
我三角形的问题与Ruby的IRB:
IPSocket.getaddress(Socket.gethostname) SocketError: getaddrinfo: nodename nor servname provided, or not known
所以,我不知道这是解析器不理解的主机名,或者如果有一些奇怪的机器的配置,或者如果它是个错误在我们网络的DNS查找中有点奇怪,但是不管安装程序是什么都不快乐。我认为这是安装程序的一个良性失败,所以我觉得安全的强制测试成功,但我不知道如何告诉pythonbrew如何忽略该测试值或特别是通过test_socket。
我也看到了以下状态,但还没有想出如果他们显著尚未:
33 tests skipped: test_al test_bsddb test_bsddb3 test_cd test_cl test_codecmaps_cn test_codecmaps_hk test_codecmaps_jp test_codecmaps_kr test_codecmaps_tw test_curses test_dl test_epoll test_gdbm test_gl test_imageop test_imgfile test_largefile test_linuxaudiodev test_normalization test_ossaudiodev test_pep277 test_py3kwarn test_smtpnet test_socketserver test_startfile test_sunaudiodev test_timeout test_urllib2net test_urllibnet test_winreg test_winsound test_zipfile64 1 skip unexpected on darwin: test_dl
人有经验,获得的Python 2.6.6与雪豹pythonbrew安装?
更新:我只是尝试了socket.gethostbyname(socket.gethostname())
命令从我的MacBook Pro雪豹安装了Python,它成功地报道我的IP回来,看来问题是在工作中的系统配置。我要去问SO的兄弟“苹果”网站,看看有没有人知道它可能是什么。
两年后,我发现这是正确的解决方案。我添加了本地电话,一切正常。 – Hectron 2015-08-20 19:48:02