How to run Python 3 on the NAS


최신 업데이트일: 2024-05-08

Applicable Products

All NAS series


Scenario

Even I installed Python 3 QPKG to the App Center but I still saw version 2.7.13 while running python.


Solution

Tip

The old QTS firmware, like 4.5.4 or earlier versions might only contains Python3 3.5.2.0.2 or earlier versions.
In order to use and install newer version of Python3, please update your QTS firmware to the latest official released version.
e.g.
       Python3 3.5.2.0.2 (in QTS v4.5.4)
       Python3 3.10.4.1  (in QTS v5.0.1) 

1. Download and install Python3 in App Center (if it is not installed yet)

2. Login NAS command console via ssh using admin.

3. Add one line into python3.bash using the command below.

[~] # echo '/bin/ln -sf "${_PYTHON3_QPKG_BIN}/python3" "${_PYTHON3_QPKG_BIN}/python"' >> /etc/profile.d/python3.bash

4. source python3.bash (This action needs to be performed whenever a new ssh session is created.)

[~] # . /etc/profile.d/python3.bash

5. Update command (This action needs to be performed whenever a new ssh session is created.)

[~] # hash -r

6. After performing steps above, you are able to run python3



Further Reading

Q:  Will the above changes affect other built-in programs which needs Python2 ?

A: No. Other NAS built-in programs which needs Python2 still uses original path to run.  


이 기사가 도움이 되었습니까?

61% 의 사용자들이 도움이 된다고 생각할 것입니다.
피드백을 주셔서 감사드립니다.

이 기사가 어떻게 개선될 수 있을지 말해 주십시오.

추가 피드백을 제공하려면 아래에 포함하십시오.

사양 선택

      더 보기 적게 보기

      다른 국가/지역 사이트:

      open menu
      back to top