【问题标题】:-bash: Setting: command not found-bash:设置:找不到命令
【发布时间】:2019-09-23 11:19:06
【问题描述】:

每次我打开终端我都会收到这条消息:

Last login: Sun May  5 18:30:40 on ttys000
-bash: Setting: command not found
Marcos-MacBook-Pro:~ (myname)$

如您所见,我的 bash_profile 存在问题:

-bash: Setting: command not found

我相信这是因为我不小心使用vim 命令修改了文件。

我将发布修改后的 .bash_profile 文件,希望您能轻松发现其中是否有任何问题:

Setting PATH for Python 3.7
# The original version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.7/bin:${PATH}"
export PATH

alias python=python3
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
".bash_profile" 7L, 188C

我真的看不出有什么问题,但我是终端机上的新手。也许有办法将文件重置为默认值?

【问题讨论】:

  • 查看 .bash_profile 的第二行。
  • 你不需要export PATH;您的外壳已经从环境中获取它。别名应该放在.bashrc,因为它只用于交互式shell,不会从您的初始登录shell 继承。 (由于macOS 终端仿真器通常不是 shell 会话启动的,因此最好从.bash_profile 获取.bashrc。)

标签: bash terminal command


【解决方案1】:

您需要注释 .bash_profile 的第一行,因为它现在正尝试使用 Setting 作为 bash 声明。

您的.bash_profile 应该是:

# Setting PATH for Python 3.7
# The original version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.7/bin:${PATH}"
export PATH

alias python=python3

【讨论】:

    猜你喜欢
    • 2019-02-20
    • 2014-11-28
    • 1970-01-01
    • 2016-09-02
    • 1970-01-01
    • 2013-09-12
    • 2020-03-11
    相关资源
    最近更新 更多