前段时间给mac升级了3.0,之后每次打开terminal都会出现如下提示:
Last login: Sat Dec 18 22:39:10 on ttys000
(eval):90: command not found: dirname
(eval):90: command not found: dirname
__add_sys_prefix_to_path:6: command not found: dirname
__add_sys_prefix_to_path:7: command not found: dirname
我的终端zshrc文件是这样写的:
#python 3.9
export PATH=/Library/Frameworks/Python.framework/Versions/3.9/bin/python3.9
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/opt/anaconda3/bin/conda' 'shell.zsh' '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 <<<
后来发现python路径输入有误,直接这样写是不行的,应该这样写:
# Setting PATH for Python 3.9
# The original version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.9/bin:${PATH}"
export PATH
alias python="/Library/Frameworks/Python.framework/Versions/3.9/bin/python3.9"
仅供参考,我安装的是python 3.9。