How to run Python 3 on the NAS


Ultima data di modifica 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.  


Questo articolo è stato utile?

61% delle persone lo ritengono utile.
Grazie per il feedback.

Informarci su come può essere migliorato l'articolo:

Per offrire un’ulteriore feedback, includerlo di seguito.

Scegliere le caratteristiche

      Mostra di più Meno

      Questo sito in altre nazioni/regioni

      open menu
      back to top