2016-06-26 85 views
0

只是想问一下检查我们opscenter rpm的可能性。开始在OpsCenter找不到python解释器。 Abort - Opscenter

[[email protected]]$ sudo /etc/init.d/opscenterd start 
Starting Cassandra cluster manager opscenterd 
Starting opscenterdNo python interpreter found. Abort. 
[[email protected] start-stop-scripts]$ cd   [FAILED] 

我看到Python安装时,我们得到了这个错误,但不知道如何使在OpsCenter点就在这个位置

[[email protected] ~]$ python -V ; which python 
Python 2.7.1 
/opt/mybox/pkg/python/bin/python 

的OpsCenter安装上的/ opt/myBox上/包装/ OpsCenter中也有一些变数,我看到在位于斌在OpsCenter文件

# get around sudo vagaries in setting $HOME 
if [ "x$OPSC_HOME" = "x" ]; then 
if [ $is_mac = 1 ]; then 
    OPSC_HOME="/Users/$USER" 
else 
    OPSC_HOME=$(getent passwd $(id -u) | cut -d ':' -f 6) 
fi 
fi 
export HOME=$OPSC_HOME 

cd "$(dirname "$0")"/../ 

if [ $(uname -m) = "x86_64" ]; then 
PY_ARCH="amd64" 
else 
PY_ARCH="i386" 
fi 

# we support python2.6-2.7 
PYVERSIONS="2.6 2.7" 

[ -z "$PYTHON" ] && \ 
for i in $PYVERSIONS; do 
which python$i > /dev/null 2>&1 && PYTHON=$(which python$i) 
done 
[ -n "$PYTHON" ] || { 
echo "No python interpreter found. Abort." >&2 
exit 3 
} 

PY_VER=$($PYTHON -c "import platform; v = platform.python_version(); print  v[:v.index('.', 2)]") 
if [ $is_mac = 1 ]; then 
PY_DISTRO="./lib/py-osx/${PY_VER}/amd64" # always use 64bit for OS X 
elif [ -f "/etc/system-release" ]; then 
# This branch is for the Amazon Linux distribution 
# We will use the highest level "VER" available because Amazon Linux 
# does not use version numbers like RHEL and Centos 
VER=`ls -1 ./lib/py-redhat/${PY_VER}/ | sort -n | tail -n 1` 
PY_DISTRO="./lib/py-redhat/${PY_VER}/shared/${PY_ARCH}:./lib/py-redhat/${PY_VER}/${VER}/${PY_ARCH}" 
elif [ -f "/etc/redhat-release" ]; then 
VER=`rpm -q centos-release --qf %{VERSION}` 
if [ 1 -eq $? ]; then 
    VER=`rpm -q redhat-release --qf %{VERSION}` # RHEL 5 
    if [ 1 -eq $? ]; then 
     VER=`rpm -q redhat-release-server --qf %{VERSION}` # RHEL 6 
     if [ 1 -eq $? ]; then 
      VER=`rpm -q enterprise-release --qf %{VERSION}` # Oracle Linux 
     fi 
    fi 
fi 
VER=`echo $VER | cut -b 1` 
PY_DISTRO="./lib/py-redhat/${PY_VER}/shared/${PY_ARCH}:./lib/py-redhat/${PY_VER}/${VER}/${PY_ARCH}" 
else 
PY_DISTRO="./lib/py-debian/${PY_VER}/${PY_ARCH}" 
fi 

export PYTHONPATH="./src:\ 
/usr/lib/python${PY_VER}/site-packages:\ 
./src/lib/python${PY_VER}/site-packages:\ 
./lib/python${PY_VER}/site-packages:\ 
./lib/py:\ 
${PY_DISTRO}:\ 
${PYTHONPATH}:" 
+0

在终端中运行'which python2.7'时会打印什么? (/ usr/kerberos/bin:/ opt/mybox/pkg/bin)/ usr/lib/bin/python –

+0

[opscenter @ mybox〜] $ which python 2.7 /opt/mybox/pkg/python/bin/python /python/bin:/ usr/local/bin:/ bin:/ usr/bin:/ opt/mybox/pkg/opscenter/bin:/ sbin:/ usr/local/bin:/ usr/bin) –

+0

将一个空格在'python'和'2.7'之间,所以'which'认为它们是两个独立的命令。请再试一次,不要插入空格,并将结果粘贴到您的问题中,以代码块形式保存。 –

回答

1

不知道如何做opscenter指向它在这个位置

由于这是你的具体问题,我会在这里回应我的评论作为答案。

在运行opscenter init脚本之前,您可以将PYTHON设置为您的python解释器。这将绕过python 2.6或2.7(通过-z测试)的检查,并允许您只告诉脚本python在哪里。

$ export PYTHON=/opt/mybox/pkg/python/bin/python 
$ sudo /etc/init.d/opscenterd start 

至于根本原因为什么发生这种情况,我怀疑PM 2Ring是正确的,蟒蛇不是用户(root,看来)这是开始的OpsCenter的路径上。