在Linux中更改路径 [英] Change path in linux

查看:49
本文介绍了在Linux中更改路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尽管我认为我已经接近Linux专业人士,但显然我仍然是一个初学者.登录服务器时,需要使用最新版本的R(统计软件).R安装在2个地方.当我运行以下命令时

Although I thought I'm close to be professional in Linux but apparently I'm still a beginner. When I login to a server, I need to use the latest version of R (a statistical software). R is installed in 2 places. When I run the following command

which R

我知道

/usr/bin/R

然后

R --version
R version 2.15.2 (2012-10-26) -- "Trick or Treat"
Copyright (C) 2012 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: x86_64-redhat-linux-gnu (64-bit)

显然它是一个旧版本,我知道R的最新版本已安装在

apparently it is an old version and I know the last version of R is installed in

/usr/local/bin/R

我知道我应该改变道路.我对吗?以及如何?

I know I should change the path. Am I right? and How?

推荐答案

如果将以下内容放入 .bashrc 中,您将首先获得较新的 R ,因为bash将在另一个目录之前搜索该目录.

If you put the following in your .bashrc you will get the newer R first, because bash will search that directory before the other one.

export PATH=/usr/local/bin:$PATH

更新:由于OP显然是在使用 tcsh ,所以设置路径的正确方法是在内使用 setenv 〜/.profile 〜/.tcshrc .

Update: Since the OP is apparently using tcsh, the correct way to set the path is to use setenv inside ~/.profile or ~/.tcshrc.

setenv PATH /usr/local/bin:$PATH

这篇关于在Linux中更改路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆