Ponderfly / GoogleTranslateIpCheck

MIT License
4.5k stars 461 forks source link

mac终端输入代码显示“no such file” #26

Closed z-pyyyy closed 1 year ago

z-pyyyy commented 1 year ago

您好,mac中输入代码后显示如下 yunceng@dengdaizhaiyueliangderendeMacBook-Air ~ % cd/Users/yunceng/Downloads/GoogleTranslateIpCheck-mac\ 3 zsh: no such file or directory: cd/Users/yunceng/Downloads/GoogleTranslateIpCheck-mac 3

z-pyyyy commented 1 year ago

您好,我想补充一下,之前在修改hosts的文件的时候不小心把hosts的文件格式设置成了“纯文本文稿“(其他的文件格式都只是”文稿“),并且现在不知道怎么修改回去了,也不知道有没有影响,想要求助大佬,感谢

Ponderfly commented 1 year ago

打开终端 输入cd 把解压后的文件夹拖进终端,点击回车 复制粘贴代码,点击回车 chmod +x GoogleTranslateIpCheck sudo ./GoogleTranslateIpCheck

Ponderfly commented 1 year ago

https://cloud.tencent.com/developer/article/1703290

z-pyyyy commented 1 year ago

抱歉再次打扰您! 我按照您的网址操作了一下,但是输入“sudo vi /etc/hosts”的代码后,它显示 E325: ATTENTION Found a swap file by the name "/etc/.hosts.swp" owned by: root dated: - 2 13 14:33:47 2023 file name: /private/etc/hosts modified: YES user name: root host name: dengdaizhaiyueliangderendeMacBook-Air.1 process ID: 7556 While opening file "/etc/hosts" dated: = 3 08 23:06:02 2023 NEWER than swap file! (1) Another program may be editing the same file. If this is the case, be careful not to end up with two different instances of the same file when making changes. Quit, or continue with caution. (2) An edit session for this file crashed. If this is the case, use ":recover" or "vim -r /etc/hosts" to recover the changes (see ":help recovery"). If you did this already, delete the swap file "/etc/. hosts.swp" to avoid this message. Swap file "/etc/ hosts.swp' already exists! [Olpen Read-Only, (E)dit anyway, (R)ecover, (Delete it, (Q)uit, (A)bort: |

之后我输入了r并进行了一系列操作后将代码按照格式修改,且etc文件夹中的hosts也已经是修改后的文稿和格式,但是再次打开终端并输入cd和文件后仍然显示“ no such file or directory” 以下是我修改的终端,

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 172.253.117.90 translate.googleapis.com

Ponderfly commented 1 year ago

最简单就是复制到桌面上修改好在复制回去

Ponderfly commented 1 year ago

这个提示是因为您之前使用Vim编辑/etc/hosts文件时没有正常退出,导致生成了一个.swp文件。 您可以根据提示选择以下操作:

输入O,以只读模式打开文件,不做任何修改。 输入E,强制编辑文件,但可能会覆盖其他程序的修改。 输入R,恢复之前的修改,并删除.swp文件。 输入D,删除.swp文件,并重新打开文件。 输入Q或A,退出Vim,并放弃修改。 建议先输入R恢复之前的修改,然后保存并退出Vim。如果没有需要恢复的修改,您可以直接输入D删除.swp文件,并重新打开文件。

z-pyyyy commented 1 year ago

感谢您的多次回答,但我将文件复制到桌面并操作修改以后,系统仍然显示 "/Desktop/hosts" "/Desktop/hosts" E212: Can't open file for writing Press ENTER or type command to continue

本人实在愚钝,对此不甚了解,如果可以的话,可以付费请您帮忙远程操作一下嘛

Ponderfly commented 1 year ago

没权限 你参考下这个https://blog.csdn.net/qq_22200671/article/details/109223464

z-pyyyy commented 1 year ago

😩谢谢你,问了你好多次太麻烦你了,我一直没有弄成功,甚至找了好几家淘宝远程也都没办法,还是算了吧,麻烦了

Ponderfly commented 1 year ago

很简单的啊,就是用管理员权限编辑文本

z-pyyyy commented 1 year ago

哈哈哈哈我编辑了呀,还编辑了很多次,但是不是编辑的有点问题呀(程序代码我不太看得懂),我再试一试吧

z-pyyyy commented 1 year ago

卧槽好像可以了!激动哈哈哈哈哈,之前应该就是代码搞错了,谢谢!!哇哈哈哈哈