首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >找不到python解释器。中止- Opscenter

找不到python解释器。中止- Opscenter
EN

Stack Overflow用户
提问于 2016-06-26 19:27:14
回答 1查看 123关注 0票数 0

我只想问一下在我们的opscenter rpm上有什么可能性。启动opscenter时出现此错误

代码语言:javascript
复制
[opscenter@mybox]$ sudo /etc/init.d/opscenterd start
Starting Cassandra cluster manager opscenterd
Starting opscenterdNo python interpreter found. Abort.
[opscenter@mybox start-stop-scripts]$ cd            [FAILED]

我看到安装了python,但不确定如何使操作员将其指向此位置。

代码语言:javascript
复制
[opscenter@mybox ~]$ python -V ; which python
Python 2.7.1
/opt/mybox/pkg/python/bin/python

Opscenter安装在/opt/mybox/pkg/opscenter上,我在位于bin的opscenter文件中看到了一些变量

代码语言:javascript
复制
# 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}:"
EN

回答 1

Stack Overflow用户

发布于 2016-06-28 02:08:40

不确定如何使操作者将其指向此位置

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

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

代码语言:javascript
复制
$ export PYTHON=/opt/mybox/pkg/python/bin/python
$ sudo /etc/init.d/opscenterd start

至于发生这种情况的根本原因,我怀疑PM 2Ring是正确的,python不在启动OpsCenter的用户(似乎是根用户)的路径上。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/38038038

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档