今天在vmware虚拟机安装宝塔时报错,没有多想就认为是系统镜像问题,于是重新下载了其他镜像,结果一样报错,报错信息如下:
代码语言:javascript复制 self.update_environ()
File "/www/server/panel/pyenv/lib/python3.7/site-packages/gevent/pywsgi.py", line 1558, in update_environ
name = socket.getfqdn(address[0])
File "/www/server/panel/pyenv/lib/python3.7/site-packages/gevent/_socketcommon.py", line 304, in getfqdn
hostname, aliases, _ = gethostbyaddr(name)
File "/www/server/panel/pyenv/lib/python3.7/site-packages/gevent/_socketcommon.py", line 276, in gethostbyaddr
return get_hub().resolver.gethostbyaddr(ip_address)
File "/www/server/panel/pyenv/lib/python3.7/site-packages/gevent/resolver/thread.py", line 66, in gethostbyaddr
return self.pool.apply(_socket.gethostbyaddr, args, kwargs)
File "/www/server/panel/pyenv/lib/python3.7/site-packages/gevent/pool.py", line 161, in apply
return self.spawn(func, *args, **kwds).get()
File "src/gevent/event.py", line 306, in gevent._gevent_cevent.AsyncResult.get
File "src/gevent/event.py", line 336, in gevent._gevent_cevent.AsyncResult.get
File "src/gevent/event.py", line 324, in gevent._gevent_cevent.AsyncResult.get
File "src/gevent/event.py", line 304, in gevent._gevent_cevent.AsyncResult._raise_exception
File "/www/server/panel/pyenv/lib/python3.7/site-packages/gevent/_compat.py", line 65, in reraise
raise value.with_traceback(tb)
File "/www/server/panel/pyenv/lib/python3.7/site-packages/gevent/threadpool.py", line 167, in __run_task
thread_result.set(func(*args, **kwargs))
UnicodeError: encoding with 'idna' codec failed (UnicodeError: label empty or too long)
可以看到gethostbyaddr错误信息,可能是获取系统的主机名失败,我们尝试修改一个主机名
代码语言:javascript复制# 修改系统的主机名
hostnamectl set-hostname 主机名
# 重启系统生效
reboot
成功解决问题