我试图在CentOS 6.8服务器上使用软件集合,但如果传递的命令是" bash",则它不会核心地设置环境变量PATH,但是" tcsh的"工作...(但我们不在这台机器上使用tcsh)
示例:
$ scl --list
devtoolset-4
python27
rh-java-common
rh-perl524
rh-python35
$ which python
/usr/bin/python
$ python --version
Python 2.6.6
$ scl enable python27 bash
$ which python
/usr/bin/python
$ python --version
Python 2.6.6
$ cat /opt/rh/python27/enable
export PATH=/opt/rh/python27/root/usr/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/opt/rh/python27/root/usr/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
export MANPATH=/opt/rh/python27/root/usr/share/man:${MANPATH}
# For systemtap
export XDG_DATA_DIRS=/opt/rh/python27/root/usr/share:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}
# For pkg-config
export PKG_CONFIG_PATH=/opt/rh/python27/root/usr/lib64/pkgconfig${PKG_CONFIG_PATH:+:${PKG_CONFIG_PATH}}
$ echo $PATH
/usr/share/gridengine/bin/lx26-amd64:/usr/lib64/qt-3.3/bin:/usr/NX/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/bin:/opt/maker/bin:/opt/tools/:/opt/tools/amos-3.1.0:/opt/mpich-install/bin:/opt/pssc/bin:/opt/torque/bin:/opt/torque/sbin
$ echo $LD_LIBRARY_PATH
/opt/rh/python27/root/usr/lib64
$ echo $MANPATH
/opt/rh/python27/root/usr/share/man::/opt/mpich-install/share/man:/opt/mpich-install/share/man
那么为什么MANPATH
和LD_LIBRARY_PATH
设置正确而不是PATH
?如果我使用tcsh它按预期工作:
$ scl enable python27 tcsh
$ which python
/opt/rh/python27/root/usr/bin/python
$ python --version
Python 2.7.8
答案 0 :(得分:0)
谢谢Dominic,你有所收获。我最初检查了~/.bash*
个文件以及/etc/bash*
和/etc/profile
但是在您发表评论后,我在/etc/profile.d/
找到了几个我们正在执行的脚本,其中一个设置了PATH显然没有附加。我在那里添加了$PATH
,现在scl enable
正在按预期工作!