设置环境变量求助

ilovemeat 2011-05-04 12:20:07
老板给了我一个128核的服务器的supervisor的权限,叫我跑模拟。机器装的是rhle5. 但是我不能正确装
软件。老板的账户ssh进去可以正常工作,他也给了我几个环境变量:


PATH=/usr/local/bin:/usr/lib64/qt-
3.3/bin:/usr/kerberos/bin:/bin:/usr/bin:/usr/X11R6/bin:/usr/lib64/openmpi/1.
4-
gcc/bin:/usr/lib64/openmpi/1.4-gcc/lib

LD_LIBRARY_PATH=/usr/lib64/openmpi/1.4-gcc/lib
QTDIR=/usr/lib64/qt-3.3
QTINC=/usr/lib64/qt-3.3/include
QTLIB=/usr/lib64/qt-3.3/lib
MPICC=/usr/lib64/openmpi/1.4-gcc/bin/mpicc
MPIEXEC=/usr/lib64/openmpi/1.4-gcc/bin/mpiexec
LIBS=/usr/lib64/openmpi/1.4-gcc/lib/libmpi_cxx.so.0


我用我的账户登进去,进行设置。
我在tcsh下面用这种格式:
setenv PATH $PATH":/usr/local/bin:/usr/lib64/qt-
3.3/bin:/usr/kerberos/bin:/bin:/usr/bin:/usr/X11R6/bin:/usr/lib64/openmpi/1.
4-
gcc/bin:/usr/lib64/openmpi/1.4-gcc/lib"

把第一行搞定了。但是不知道为什么mpicc和 mpieexec 的该如何输入。
用setenv PATH $MPICC":/usr/lib64/openmpi/1.4-gcc/bin/mpicc" 这种吗?
我试了好像不行。

又找了老板,他说我需要自己改写 .mycshrc文件。我找到了我默认的home。找到了这个文件。请问我该如何把他给我的环境变量给转换成那个.mycshrc的格式呢?
我的.cshrc的格式如下:

################################################################################
# #
# .cshrc file (initial setup file for C-Shells) #
# #
# WARNING: PLEASE READ THE REST OF THIS FILE BEFORE MAKING ANY CHANGES !!! #
# #
################################################################################

if (-d /usr/athena/lib/skeleton) then
set skeleton=/usr/athena/lib/skeleton
else
set skeleton=/afs/bp.ncsu.edu/system/common/skeleton
endif

if (-r $skeleton/cshrc) then
source $skeleton/cshrc
else
if ($?prompt) then
echo "WARNING: System-wide initialization files were not found."
echo " C-Shell initialization has not been performed."
endif
set path = (/bin $HOME/bin /usr/local/bin /usr/bin/X11 /usr/athena/bin \
/usr/afsws/bin /usr/ucb /usr/bin .)
limit coredumpsize 0
set prompt="eos% "
set ignoreeof
umask 077
alias rm rm -i
endif

if ($?XSESSION) then
if (-r /usr/athena/bin/end_session) alias logout '/usr/athena/bin/end_session && exit '
if (-r /usr/bin/end_session) alias logout '/usr/bin/end_session && exit '
endif

################################################################################
# #
# If you would like to modify any of these variables, please make #
# the changes in a file called .mycshrc located in the top level #
# of your home directory. #
# #
#----- HOW TO C U S T O M I Z E YOUR OWN E N V I R O N M E N T ------#
# #
# .mycshrc This file is sourced by the system to override any default C #
# shell variables. You can use the unset/unalias or set/alias #
# commands to customize your own C shell environment. #
# #
# .xsession This file is invoked by the system to start up your own X11 #
[ Read 6


是不是我就把它复制一个起名叫.mycshrc? 然后格式完全按照这个。只不过把我需要加的那些参数按照格式替换
set path = (/bin $HOME/bin /usr/local/bin /usr/bin/X11 /usr/athena/bin \
/usr/afsws/bin /usr/ucb /usr/bin .)
就可以了?
...全文
251 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
ilovemeat 2011-05-05
  • 打赏
  • 举报
回复
谢谢大师指点。我试了用setenv MPICC $MPICC”:/usr/lib64/openmpi/1.4-gcc/bin/mpicc”
显示 MPICC: Undefined variable.

但是我回到bash下。用export
export MPICC=”/usr/lib64/openmpi/1.4-gcc/bin/mpicc”
就设置成了。

能介绍一下直接写在.cshrc 里面如何写吗? 就是建一个空文件,然后按照set 那个格式一条一条写上去吗?
rucypli 2011-05-05
  • 打赏
  • 举报
回复
128核。。。。
freetstar 2011-05-04
  • 打赏
  • 举报
回复
一般卸载你的~/.cshrc理就行了

格式应该是export $PATH:你的path
yong_f 2011-05-04
  • 打赏
  • 举报
回复
setenv PATH $MPICC":/usr/lib64/openmpi/1.4-gcc/bin/mpicc"
这个意思设置环境变量PATH, $MPICC意思是在这次设置PATH值时MPICC的值。
如果MPICC=/usr则
PATH=/usr:/usr/lib64/openmpi/1.4-gcc/bin/mpicc

改成这样
setenv MPICC $MPICC":/usr/lib64/openmpi/1.4-gcc/bin/mpicc"
这个意思设置环境变量MPICC, $MPICC意思是在这次设置MPICC值时MPICC的值。

你应该可以明白了
ilovemeat 2011-05-04
  • 打赏
  • 举报
回复
以下就是我cshrc文件的全部内容。你是说加在开头吗?还是把这些删掉然后写export? 另外cshrc不是给csh用的吗?是不是应该用set 的?

################################################################################
# #
# .cshrc file (initial setup file for C-Shells) #
# #
# WARNING: PLEASE READ THE REST OF THIS FILE BEFORE MAKING ANY CHANGES !!! #
# #
################################################################################

if (-d /usr/athena/lib/skeleton) then
set skeleton=/usr/athena/lib/skeleton
else
set skeleton=/afs/bp.ncsu.edu/system/common/skeleton
endif

if (-r $skeleton/cshrc) then
source $skeleton/cshrc
else
if ($?prompt) then
echo "WARNING: System-wide initialization files were not found."
echo " C-Shell initialization has not been performed."
endif
set path = (/bin $HOME/bin /usr/local/bin /usr/bin/X11 /usr/athena/bin \
/usr/afsws/bin /usr/ucb /usr/bin .)
limit coredumpsize 0
set prompt="eos% "
set ignoreeof
umask 077
alias rm rm -i
endif

if ($?XSESSION) then
if (-r /usr/athena/bin/end_session) alias logout '/usr/athena/bin/end_session && exit '
if (-r /usr/bin/end_session) alias logout '/usr/bin/end_session && exit '
endif

################################################################################
# #
# If you would like to modify any of these variables, please make #
# the changes in a file called .mycshrc located in the top level #
# of your home directory. #
# #
#----- HOW TO C U S T O M I Z E YOUR OWN E N V I R O N M E N T ------#
# #
# .mycshrc This file is sourced by the system to override any default C #
# shell variables. You can use the unset/unalias or set/alias #
# commands to customize your own C shell environment. #
# #
# .xsession This file is invoked by the system to start up your own X11 #
[ Read 6

19,612

社区成员

发帖
与我相关
我的任务
社区描述
系统使用、管理、维护问题。可以是Ubuntu, Fedora, Unix等等
社区管理员
  • 系统维护与使用区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧