添加hostname即可
(base) renfangri@IrvingonedeMacBook-Air ~ % sudo vim /etc/hosts
Password:
输入密码
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
127.0.0.1 IrvingonedeMacBook-Air.local
# Added by Docker Desktop
# To allow the same kube context to work on the host and the container:
127.0.0.1 kubernetes.docker.internal
# End of section
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
"/etc/hosts" 14L, 410C
按 i 进行插入
127.0.0.1 IrvingonedeMacBook-Air.local
然后esc 然后 :wq 保存并退出
这是我添加进去的,成功解决问题
注意⚠️:一定要插入到最下面一行,不然还是会报错
不知道主机名的可以这样获得
(base) renfangri@IrvingonedeMacBook-Air ~ % python
Python 3.9.6 | packaged by conda-forge | (default, Jul 11 2021, 03:35:11)
[Clang 11.1.0 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import socket
>>> socket.gethostname()
'IrvingonedeMacBook-Air.local'
>>>