How to run Python 3 on the NAS


Zuletzt geändertes Datum 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.  


War dieser Artikel hilfreich?

61% der Nutzer fanden es hilfreich.
Vielen Dank für Ihre Rückmeldung.

Bitte teilen Sie uns mit, wie dieser Artikel verbessert werden kann:

Wenn Sie zusätzliches Feedback geben möchten, fügen Sie es bitte unten ein.

Wählen Sie die Spezifikation

      Mehr anzeigen Weniger

      Diese Seite in anderen Ländern / Regionen:

      open menu
      back to top