Installing Python for Calling Python Code

Publish Date: Oct 09, 2018 | 11 Ratings | 1.27 out of 5 | Print

Overview

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

Table of Contents

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.

  • (Windows) If you install Python 3.6, add the directory containing python36.dll to the system path. If you install Python 2.7, add the directory containing  python27.dll to the system path.
  • (Linux) Install Python by building from the source to ensure that libpython27.so and libpython36.so are available in the standard search directories.

(Linux) Installing Python from Source

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

 

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

 

Additional Resources

How to set the path and environment variables in Windows

Back to Top

Bookmark & Share


Ratings

Rate this document

Answered Your Question?
Yes No

Submit