bash_profile打开cv和fi错误

bash_profile open cv and fi error

需要解决的问题很少。 首先有一个错误。 -bash: /Users/jay/.bash_profile: 第 7 行: `fi'

其次,我在更新 .bash_profile 以安装 opencv 时遇到问题。 http://www.pyimagesearch.com/2015/06/15/install-opencv-3-0-and-python-2-7-on-osx/

这是下面的代码,请帮忙。

非常感谢!

# added by Anaconda2 4.2.0 installer
export PATH="/Users/jay/anaconda2/bin:$PATH"
export PATH=/usr/local/bin:$PATH

  source '/Users/jay/Downloads/google-cloud-sdk/path.bash.inc'
fi
  source '/Users/jay/Downloads/google-cloud-sdk/completion.bash.inc'
fi

# The next line updates PATH for the Google Cloud SDK.
if [ -f /Users/jay/Downloads/google-cloud-sdk/path.bash.inc ]; then
  source '/Users/jay/Downloads/google-cloud-sdk/path.bash.inc'
fi

# The next line enables shell command completion for gcloud.
if [ -f /Users/jay/Downloads/google-cloud-sdk/completion.bash.inc ]; then
  source '/Users/jay/Downloads/google-cloud-sdk/completion.bash.inc'

你有 fi 没有 if 的语句(fi 是 'opening' if 的 'closing' 语句):

  source '/Users/jay/Downloads/google-cloud-sdk/path.bash.inc'
fi
  source '/Users/jay/Downloads/google-cloud-sdk/completion.bash.inc'
fi

bash syntax for if statements 例如

if [ -f /var/log/messages ]; then
    echo "/var/log/messages exists."
fi

所以对你来说这可能是:

if [ -f '/Users/jay/Downloads/google-cloud-sdk/path.bash.inc'];  then
    source '/Users/jay/Downloads/google-cloud-sdk/path.bash.inc'
fi

下一行类似。

并且文件末尾缺少最后一个 fi