bash - 为什么我在修改 .bash_profile 以在 macOS Catalina 上安装 Tensorflow + OpenCV 时出现这些语法错误?
问题描述
我正在尝试在 Jupyter Notebook(Python 3.7,macOS Catalina)上创建一个深度学习环境,并将 Tensorflow 和 OpenCV 放在上面。我正在遵循以下网站上的说明:https ://mc.ai/deep-learning-on-macos-catalina/ 。我在步骤“将以下内容添加到 .bash_profile 文件...”。我刚刚做了(不确定我什么时候打算将“export PS1”中的部分添加到“/virtualenvwrapper.sh”,所以我只是随意地把它放在那里)它看起来像这样(在我使用 nano 查看它之后.bash_profile)。
export PS1="___________________ | \w @ \h (\u) \n| => "
export PS2="| =>
# virtualenv and virtualenvwrapper
export WORKON_HOME=$HOME/.virtualenvs
export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python3
source /usr/local/bin/virtualenvwrapper.sh
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/opt/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/opt/anaconda3/etc/profile.d/conda.sh" ]; then
. "/opt/anaconda3/etc/profile.d/conda.sh"
else
export PATH="/opt/anaconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
但是,我收到两个错误:
-bash: .bash_profile: line 16: unexpected EOF while looking for matching `"'
-bash: .bash_profile: line 21: syntax error: unexpected end of file
为了继续下一步,我需要做些什么来解决这些问题?
否则,有没有更简单的方法可以在同一环境中同时使用 Tensorflow 和 OpenCV 而无需经历所有这些?(知道我已经有 Anaconda Python 3.7)
非常感谢 !
更新:我在这里和那里尝试了一些东西,我的新 .bash_profile 现在看起来像这样:
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin
export PS1="___________________ | \w @ \h (\u) \n| => "
export PS2="| =>
alias ll='ls -FGlAhp'
export PATH=/usr/local/bin:$PATH
>>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/opt/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/opt/anaconda3/etc/profile.d/conda.sh" ]; then
. "/opt/anaconda3/etc/profile.d/conda.sh"
else
export PATH="/opt/anaconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
但是我现在终端窗口有问题,我不知道如何处理它。
我实际上有同样的错误:
-bash: .bash_profile: line 19: unexpected EOF while looking for matching `"'
-bash: .bash_profile: line 24: syntax error: unexpected end of file
提前致谢!
解决方案
正如@Cromax 在我的问题帖子下的评论中指定的那样,我忘记关闭第 4 行中的双引号。
推荐阅读
- docker - https://localhost:8080/console :Hasura 控制台不适用于 chrome 浏览器
- python - 将 RGB 图像中每个通道的均值和标准差更改为自定义值的最有效方法?
- javascript - Yeoman - 在循环依赖中访问模块导出的不存在属性____
- python - 具有相同值的多个不可变对象是否指向内存中的单个对象?
- javascript - 重新映射 javascript(或 jquery)中的 Control + S 按钮
- angular - 属性“地图”在其初始化之前使用。(Angular 中的谷歌地图)
- php - Laravel 8 中的自定义 DatabaseSessionHandler
- python-3.x - 我想在 python 中打印斐波那契数列的 fib(5) 以找到否。fib(0) 的次数?错误“函数”对象没有属性“_args_counter”
- java - 试图在jsp中显示图像(保存在mysql中的图像url和图像存储在一个文件夹中)但它不起作用
- f# - F# - 从选项类型函数中获取元组的 fst 元素