You can integrate code developed in Python® from LabVIEW by using the LabVIEW Python functions. The LabVIEW Python Node provides native capability to intuitively call a Python script from a LabVIEW Block Diagram. It uses LabVIEW primitives, providing a way to interoperate between the languages with low latency.
Use the following table to determine which version of Python is compatible with your LabVIEW version. Although unsupported versions might work with the LabVIEW Python functions, NI recommends using supported versions of Python only.
Note – this functionality was introduced in LabVIEW 2018 and is not available in previous versions.
LabVIEW Version | Python Version | |||||
---|---|---|---|---|---|---|
3.10 | 3.9 | 3.8 | 3.7 | 3.6 | 2.7 | |
2024 Q3 | ||||||
2024 Q1 | ||||||
2023 Q3 | ||||||
2023 Q1 | ||||||
2022 Q3 | ||||||
2021 SP1 | ||||||
2021 | ||||||
2020 SP1 | ||||||
2020 | ||||||
2019 SP1 | ||||||
2019 | ||||||
2018 SP1 | ||||||
2018 |
Compatible
You must install Python to use the LabVIEW Python functions; and to run the Python code, LabVIEW requires the Python shared libraries in the system path. Follow steps for your operating system to add the Python shared libraries to the system path.
Before you begin:
Download and install the Python Interpreter in a compatible version. You can either either use the pure Python Interpreter installation, or a IDE which also installs the Python Interpreter.
LabVIEW will then use registry entries to find the installed python3.x interpreters. Alternatively, use the Python path input of the Open Python Session.vi.
Use the package manager of your Linux Distribution to get the Python Interpreter in a compatible version. You can either either use the pure Python Interpreter installation, or a IDE which also installs the Python Interpreter.
LabVIEW search in /bin/python3.x, /usr/local/bin/python3.x and /usr/bin/python3.x for installed python3.x interpreters. Alternatively, use the Python path input of the Open Python Session.vi.
There are multiple examples from LabVIEW that demonstrate how to set up your block diagram and call your Python code.
Examples for using the Python Node are available in the LabVIEW Example Finder (found in Help >> Find Examples...) under Communicating with External Applications >> Using External Code >> Integrating Python Code.
LabVIEW 2023 Q1 supports Anaconda and venv virtual environments with the new Open Virtual Environment Session function.
Windows® is registered trademarks of Microsoft Corporation in the United States and/or other countries.
Python® is a registered trademark of the PSF.