socket.gaierror: [Errno 8] nodename nor servname provided, or not known
The reason: hostname not written in / etc / hosts Lane
Simply agile, solution:
1. The need to write the hostname hosts file, how to get hostname
python # into the environment python >>> Import socket >>> socket.gethostname () >>>> Exit ()
2. Modify the hosts file
vim / etc / hosts 127.0.0.1 hostname # will get to write the hostname come
3.Mac system modifies the hosts file with restricted access, we have successfully resolved, reference links
https://jingyan.baidu.com/article/f3ad7d0f55154309c3345bdd.html