如何在 OSX 上为 python3 设置别名

Noa*_*iss 2 terminal python alias path macos

我正在尝试为其设置别名,python3以便我可以使用python.

这是我的当前 .bash_profile

# Setting PATH for Python 3.6
# The original version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.6/bin:${PATH}"
export PATH
alias python=“python3”
alias 3=“python3”
alias py=“python3”
Run Code Online (Sandbox Code Playgroud)

当我跑步时,python我得到-bash: “python3”: command not found.

我可以运行python3并且它会正确打开py 3.X.X3.6.1在发布时)。

多年来在这里& SO上有很多半答案,还有一些评论提到了我的问题,但希望这可以成为完整答案的资源。或者也许你们中的一个人比我更擅长谷歌搜索,这可能是一个重复的问题!

Dav*_*ill 5

当我跑步时,python我得到-bash: “python3”: command not found

你为什么使用(智能引号)而不是'(普通单引号)?

尝试以下(已更正) .bash_profile

# Setting PATH for Python 3.6
# The original version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.6/bin:${PATH}"
export PATH
alias python='python3'
alias 3='python3'
alias py='python3'
Run Code Online (Sandbox Code Playgroud)

进一步阅读