shell 为什么这会永久地使我的终端无法运行命令?

c7rzv4ha  于 6个月前  发布在  Shell
关注(0)|答案(1)|浏览(75)

嗨,我破坏了我的终端环境或其他东西,因为我不知道这些东西是如何工作的,我试图按照Github上的安装说明安装tartube。所以盲目地将指南中的命令复制/粘贴到终端.然后在我运行这些命令进行安装故障排除后:

echo "export PATH="python3 -m site --user-base/bin:$PATH"" >> ~/.zprofile

source ~/.zprofile

字符串
这是我的终端打开并尝试运行一些基本命令后的样子:

Last login: Sat Nov 11 20:10:15 on ttys000
/Users/censoringmyfullname/.zprofile:export:6: not valid in this context: -m
/etc/zshrc:7: command not found: locale
/etc/zshrc_Apple_Terminal:104: command not found: mkdir
censoringmyfullname@supername-mbp ~ % zsh
zsh: command not found: zsh
censoringmyfullname@supername-mbp ~ % brew
zsh: command not found: brew
censoringmyfullname@supername-mbp ~ % sudo
zsh: command not found: sudo
censoringmyfullname@supername-mbp ~ % 
censoringmyfullname@supername-mbp ~ % echo $PATH
/opt/homebrew/bin:/opt/homebrew/bin:/Users/censoringmyfullname/.pyenv/bin:python3


所以现在我的终端在我打开它的时候说奇怪的东西,没有一个命令工作。我已经尝试了一堆互联网指南重置zsh shell,不管是什么,通过PATH =“gibb:/erish/gobblygook”的一些变体,没有任何工作。
任何建议或特别是命令,神奇地解决这一点,没有解释将完全赞赏grug,这样我就可以回到世界的概念,我理解,谢谢你!(我会venmo和/或发送良好的共鸣-谢谢你)
我读了这个https://support.apple.com/en-us/HT208050和这个https://youngstone89.medium.com/setting-up-environment-variables-in-mac-os-28e5941c771c还有这个Command not found when opening terminal, possible conda issue?
但都无济于事

pkmbmrz7

pkmbmrz71#

该命令中的引号 * 完全 * 乱了,所以要做的第一件事是从你的~/.zprofile文件中删除它添加的行。从错误消息来看,这似乎是文件中的第6行(可能是最后一行,除非在它后面添加了其他东西)。这一行看起来像这样:

export PATH=python3 -m site --user-base/bin:/lots/more/stuff/here

字符串
如果你对命令行编辑器感到满意,你可以使用它,但是你需要指定编辑器的完整路径,比如/usr/bin/nano ~/.profile/usr/bin/vi ~/.profile。如果你喜欢使用GUI编辑器,我推荐使用BBEdit。即使在免费/付费模式下,它也可以编辑隐藏文件(如.zprofile),它不会像许多编辑器那样添加格式,智能引号等。
一旦你删除了它,打开一个新的终端窗口,确保一切正常,然后运行这个命令将 correct 行添加到你的~/. zprofile中。我认为这会做正确的事情:

echo 'export PATH="'"$(python3 -m site --user-base)"'/bin:$PATH"' >> ~/.zprofile
source ~/.zprofile

相关问题