Integrating Python Code in LabVIEW

Overview

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.

Contents

LabVIEW and Python Compatibility

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 VersionPython Version
3.143.133.123.113.103.93.83.73.6
2026 Q3    
2026 Q1     
2025 Q3     
2025 Q1     
2024 Q3    
2024 Q1    
2023 Q3    
2023 Q1    
2022 Q3     
2021 SP1     
2021     
2020 SP1        
2020        
2019 SP1        
2019        
2018 SP1        
2018        

Compatible

Installing Python for Calling Python Code

Installing Python Shared Libraries

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:

  • Use the LabVIEW and Python Compatibility table to determine which supported version of Python to install.
  • Ensure that the bitness of Python corresponds to the bitness of LabVIEW installed on the machine.

Windows

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.

Linux

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.

LabVIEW Python Functions Examples

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.

Support for Python Virtual Environments

LabVIEW 2023 Q1 and later supports Python Virtual Environments using Open Anaconda 2 and 3 (32 and 64 bit) and Virtual Env. (venv) with the Open Virtual Environment Session function.

Additional Resources

Windows® is registered trademarks of Microsoft Corporation in the United States and/or other countries.
Python® is a registered trademark of the PSF. 

Was this information helpful?

Yes

No