威联通系统内置的python版本为2.7.18,大多命令已不适用

image.png

在app store中官方有提供python3的安装,目前版本为3.10.4.1

image.png

点击安装后,并不能直接适用,提示

image.png

是因为此安装程序未自动设置环境变量,还需要用ssh手动设置一下环境变量,ssh执行

plaintext
# 切换至admin账户
sudo -i
# 按提示输入登陆密码...
# 按提示输入q
# 按提示输入y

# 编辑文件
vim .profile

# 粘贴一下内容
_PYTHON3_QPKG_CONF=/etc/config/qpkg.conf
_PYTHON3_QPKG_NAME="Python3"
_PYTHON3_QPKG_ROOT=$(/sbin/getcfg $_PYTHON3_QPKG_NAME Install_Path -f ${_PYTHON3_QPKG_CONF})
_PYTHON3_QPKG_BIN="${_PYTHON3_QPKG_ROOT}/python3/bin"
echo "${PATH}" | grep -q  ${_PYTHON3_QPKG_BIN} || export PATH=${_PYTHON3_QPKG_BIN}:${PATH}
/bin/ln -sf "${_PYTHON3_QPKG_BIN}/python3" "${_PYTHON3_QPKG_BIN}/python"

# 保存并退出
# 按ESC
:wq

# 此处有个提示,直接回车即可返回SSH输入界面

image.png

激活一下文件

plaintext
source .profile

image.png

然后在查询python3的版本,即可

image.png

之后即可正常适用python3