Installing Python for Calling Python Code

Overview

You can call Python code from LabVIEW by using the LabVIEW Python functions. You must install Python to use the LabVIEW Python functions.

Requirements for Installing Python

LabVIEW supports calling Python version 2.7 and 3.6. Although unsupported versions might work with the LabVIEW Python functions, NI recommends using supported versions of Python only.

Ensure that the bitness of Python corresponds to the bitness of LabVIEW installed on the machine.

To run the Python code, LabVIEW requires the Python shared libraries (DLLs) in the system path.

Installing Python Shared Libraries on Windows

To install the Python shared libraries to your Windows machine, add the directory for your Python version to the system path.

Installing Python Shared Libraries on Linux

Install Python by building from the source to ensure that libpython27.so and libpython36.so are available in the standard search directories.

 

Python 2.7

Use the following command to install Python 2.7.

 su cd /usr/src wget http://www.python.org/ftp/python/2.7.5/Python-2.7.5.tar.bz2 tar -xvjf Python-2.7.5.tar.bz2 cd Python-2.7.5 ./configure --prefix=/usr/local/python2.7 --with-threads --enable-shared make install altinstall ln -s /usr/src/Python2.7.5/lib/libpython2.7.so /usr/lib ln -s /usr/src/Python2.7.5/lib/libpython2.7.so.1.0 /usr/lib ln -s /usr/src/Python2.7.5/bin/python2.7 /usr/local/bin /sbin/ldconfig -v

 

Python 3.6

Use the following command to install Python 3.6.

 su cd /usr/src wget https://www.python.org/ftp/python/3.6.3/Python-3.6.3.tgz tar -xzf Python-3.6.3.tgz cd Python-3.6.3 ./configure --prefix=/usr/local/python3.6 --with-threads --enable-shared make install altinstall ln -s /usr/src/Python-3.6.3/libpython3.6m.so /usr/lib64 ln -s /usr/src/Python-3.6.3/libpython3.6m.so.1.0 /usr/lib64 ln -s /usr/src/Python-3.6.3/python /usr/bin/python3 /sbin/ldconfig -v