0
每當我進入終端時,我可以輸入'jp'而不是'jupyter notebook'嗎?我試圖別名〜/ .bash_profile中,但它沒有工作mac上的習慣命令行
alias jp = 'jupyter notebook'
和它說
-bash: ‘jupyter: command not found
每當我進入終端時,我可以輸入'jp'而不是'jupyter notebook'嗎?我試圖別名〜/ .bash_profile中,但它沒有工作mac上的習慣命令行
alias jp = 'jupyter notebook'
和它說
-bash: ‘jupyter: command not found
有不同的方式來做到這一點:
1日的〜/ .bashrc
打開〜/ .bashrc與editor
您的選擇並在之後添加一些行:
# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
alias jp='jupyter notebook'
保存並關閉它。
第2〜/ .bash_aliases更明確
一點點是touch
一個新的文件〜/ .bash_aliases,並與editor
經常選擇打開。添加幾行,保存並關閉它。
alias jp='jupyter notebook'
alias la='ls -al'
alias ..='cd ..'
爲了需要在添加這些線路的.bashrc
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
最後,你需要重新加載源重裝bash_aliases:
1路:
$ source ~/.bashrc
創建新文件後的第二種方法:
$ source ~/.bash_aliases
您究竟是什麼別名?你的意思是「不起作用」?你的.bash_profile是否可以運行? – Robert
你是否在'='周圍輸入了空格,就像上面一樣?一定沒有。 –
@BenjaminW。你能給個例子嗎? – ZHU