Python3:AttributeError: module ‘socket’ has no attribute ‘AF_INET’ 所有的python环境都正常ls查看发现自己的文件名和socket名重名了mv socket.py 01_socket.py 总结: 给文件命名时不要跟包名同名。