简体   繁体   English

终端-bash:找不到命令错误

[英]Terminal -bash: command not found errors

I messed up something in my programming a few days ago that screwed up my terminal. 几天前,我在编程中弄乱了某些东西,弄乱了我的终端。 My terminal now gives me the a bash error message with basic functions like ls, cd, or ssh. 现在,我的终端为我提供了一条bash错误消息,其中包含ls,cd或ssh等基本功能。 The error looks like this: -bash: ls: command not found , where the "ls" can be replaced with any shell command. 错误看起来像这样:-bash:ls:命令未找到,其中的“ ls”可以用任何shell命令替换。

The only way I have found to make my terminal function, is by inputting: export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin" into ever terminal window I open, which can get very tedious. 我发现使终端功能正常的唯一方法是输入:export PATH =“ / usr / local / bin:/ usr / bin:/ bin:/ usr / sbin”到我打开的终端窗口中,该窗口可以非常乏味。

It also refuses to run Python or Jupyter unless I type the aforementioned command in the terminal window first. 除非我先在终端窗口中键入上述命令,否则它也拒绝运行Python或Jupyter。

Go files also fail to run in terminal, and gives me a similar error message: -bash: go: command not found. Go文件也无法在终端中运行,并且给了我类似的错误消息:-bash:go:命令未找到。 This can be overcome by inputting: export PATH=$PATH:/usr/local/go/bin into the terminal window first. 这可以通过输入以下命令来克服:首先将PATH = $ PATH:/ usr / local / go / bin导出到终端窗口。

I'm really worried about what is going on in my computer, and need my terminal to keep functioning in order for me to finish and pass this course (introduction to computer programming). 我真的很担心计算机中发生的事情,因此需要我的终端保持运行以使我完成并通过本课程(计算机编程入门)。 Does anyone have any ideas as to what the problem may be, and how I could go about solving it? 是否有人对问题可能是什么以及如何解决这个问题有任何想法?

Any help/advice would be greatly appreciated!!! 任何帮助/建议将不胜感激!!!

EDIT: I'm not sure if it is relevant, but I am using a Mac, and these problems started to occur after I attempted to download pygame (I say "attempted" because I never got a working version of pygame installed, though I did download several things in the process (XQuartz and a bunch of stuff from homebrew). 编辑:我不确定是否相关,但是我使用的是Mac,并且在尝试下载pygame之后,这些问题开始出现(我说“尝试过”,因为我从未安装过pygame的有效版本,尽管我确实在下载过程中下载了一些东西(XQuartz和一些来自自制软件的东西)。

Check your .profile or .bashrc : one of those files might initialize your PATH incorrectly. 检查您的.profile.bashrc :这些文件之一可能会错误地初始化PATH。

Set your PATH manually, then cd ~ , and edit those two files to fix your PATH. 手动设置PATH ,然后cd ~ ,然后编辑这两个文件以修复PATH。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM