我想使用我的brew版本的python,但是尽管许多论坛说要调整路径顺序,以便不使用与路径/usr/bin对应的OS X python。我发现,尽管我的路径设置顺序正确,但我仍然在调用旧的OS X python。
justins-mbp:~ justinthong$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
正如你所看到的,当我使用which python
命令时,它仍然给了我原始路径。
justins-mbp:site-packages justinthong$ which python
/usr/bin/python
我试图小心不要强制使用符号链接。
正在运行:
brew info python
给出您问题的答案:
此公式将 python2 可执行文件安装到
/usr/local/bin
。 如果您希望在PATH
中拥有此公式的python可执行文件,请添加 以下要~/.bash_profile
:
export PATH="/usr/local/opt/python/libexec/bin:$PATH"