在ubuntu 17.04上安装节点

时间:2017-09-08 21:17:38

标签: node.js ubuntu

我在Ubuntu上安装了节点8.0.0,然后是this answer to make it work,但现在输入retVal, cm1, dc1, cm2, dc2, r, t, e, f = cv2.stereoCalibrate(objpoints, imgpointsL, imgpointsR, cm1, dc1, cm2, dc2, (640, 480), None, None, cv2.CALIB_FIX_INTRINSIC, criteria) 时它显示criteria = (cv2.TERM_CRITERIA_EPS + cv2.TERM_CRITERIA_MAX_ITER, 100, 0.001)。我想node -v。我试图安装的那个。这是符号链接的问题还是什么?

(Ubuntu 17:04)

1 个答案:

答案 0 :(得分:2)

我建议你删除ubuntu包

sudo apt-get remove --purge nodejs-*

然后执行下面的shell脚本来安装nodejs ...你必须用下面提到的行的副本N粘贴更新〜/ .bashrc ... vi install_node.sh

#!/bin/bash

# ............... top of cut  ........................  install_node.sh

export NODE_VER=v8.0.0  # see available versions at https://nodejs.org/dist/

# pick parent dir of nodejs install  ... comment out or remove ONE of below
# export CODE_PARENT_DIR=/opt/code  # root owned dir ... requires you to sudo prior to npm install going forward
export CODE_PARENT_DIR=${HOME}    # RECOMMENDED execute as yourself including npm install

# ......... following env vars are OK no edits needed

curr_OS=$( uname )

if [[ "${curr_OS}" == "Darwin" ]]; then

    OS_ARCH=darwin-x64

elif [[ "${curr_OS}" == "Linux" ]]; then

    OS_ARCH=linux-x64
else
    echo "ERROR - failed to recognize OS $curr_OS"
    exit 5
fi

if [[ -z ${CODE_PARENT_DIR} ]]; then

    echo "ERROR - failed to see env var CODE_PARENT_DIR"
    exit 5
fi

export NODE_CODEDIR=${CODE_PARENT_DIR}/nodejs
export COMSUFFIX=tar.gz
export NODE_NAME=node-${NODE_VER}
export NODE_PARENT=${NODE_CODEDIR}/${NODE_NAME}-${OS_ARCH} 

export PATH=${NODE_PARENT}/bin:${PATH}
export NODE_PATH=${NODE_PARENT}/lib/node_modules

# ............... end of cut  ........................  install_node.sh

# copy and paste above from ... top of cut ... to here into your file ~/.bashrc   

echo
echo "NODE_CODEDIR $NODE_CODEDIR<--"
echo

echo "mkdir -p ${NODE_CODEDIR}"
echo
      mkdir -p ${NODE_CODEDIR}
echo

echo "cd ${NODE_CODEDIR}"
      cd ${NODE_CODEDIR}
echo

# this is compiled code NOT source

[ -f ${NODE_NAME}-${OS_ARCH}.${COMSUFFIX} ] && rm ${NODE_NAME}-${OS_ARCH}.${COMSUFFIX} # if file exists remove

echo "wget -q --show-progress https://nodejs.org/download/release/${NODE_VER}/${NODE_NAME}-${OS_ARCH}.${COMSUFFIX}"
      wget -q --show-progress https://nodejs.org/download/release/${NODE_VER}/${NODE_NAME}-${OS_ARCH}.${COMSUFFIX}
echo

echo "tar -C ${NODE_CODEDIR} -xf ${NODE_NAME}-${OS_ARCH}.${COMSUFFIX}"
      tar -C ${NODE_CODEDIR} -xf ${NODE_NAME}-${OS_ARCH}.${COMSUFFIX}
echo

[ -f ${NODE_NAME}-${OS_ARCH}.${COMSUFFIX} ] && rm ${NODE_NAME}-${OS_ARCH}.${COMSUFFIX} # if file exists remove

# ...........  done ........... #

which node

node --version

# ....  bottom of file   install_node.sh