【问题标题】:How do I change the default location of a terminal command?如何更改终端命令的默认位置?
【发布时间】:2017-03-02 13:18:27
【问题描述】:

考虑这个命令:

$~ which python
/home/satyarth934/anaconda3/bin/python

我希望将“python”的默认执行文件更改为“/home/satyarth934/anaconda2/bin/python”

我的机器上同时安装了 Anaconda2 和 Anaconda3。

我无法找到如何做到这一点。

【问题讨论】:

  • 这取决于PATH 变量中目录的顺序。
  • 谢谢@ceving

标签: python linux terminal anaconda


【解决方案1】:

您需要确保您的目标 python 二进制文件在 PATH 中排在第一位:

export PATH=/home/satyarth934/anaconda2/bin/:$PATH
which python

【讨论】:

    【解决方案2】:

    创建符号链接

    ln -s /path/to/original/ /path/to/linkName
    

    https://www.nixtutor.com/freebsd/understanding-symbolic-links/

    【讨论】:

      猜你喜欢
      • 2016-07-01
      • 1970-01-01
      • 2016-01-30
      • 2022-10-25
      • 2017-04-20
      • 1970-01-01
      • 2017-11-10
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多