Mac默认Python路径更改 [英] Mac Default Python Path Change
本文介绍了Mac默认Python路径更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一台Mac,碰巧到处都安装了许多不同风格的Python.
Hi I have a Mac and happen to have many different flavors of Python installed everywhere.
现在,当我在终端中打开python时,输入
right now when I opened up python in terminal, type in
which python
返回结果是:
//anaconda/bin/python
我想知道如何将默认python更改为我喜欢的python,所以下次我这样做时:
I am wondering what should I do to change the default python to a python that I like, so next time when I do:
which python
路径应为:
/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
谢谢!
推荐答案
which
命令使用$PATH
中列出的目录搜索命令的首次出现.如果要列出可执行文件的所有实例,请使用-a选项.
which
command uses the directories listed in $PATH
to search for the first occurrence of a command. If you want to list all instances of executables, use -a option.
which python2.7
输出:
/usr/bin/python2.7
这将显示指向/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
使用符号解析链接
readlink $(which python2.7)
输出:
../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
这篇关于Mac默认Python路径更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文