Using Python

Picking the default Python installation

When using New Session, if you don't wire the path to a particular Python.exe, the Toolkit will use the currently configured Python installation. You have an opportunity to choose this when the Toolkit is first installed (see Downloading and Installation), but you can change it at any time.

To choose your default Python, go to the LabVIEW Tools menu entry for "Python Integration Toolkit" and choose "Select Default Python":


Python 2 or Python 3?

The Python Integration Toolkit (1.2 and higher) supports both Python 2 and Python 3. Most installations of Canopy default to using Python 2. Follow the instructions here to create a Python 3 environment in Canopy; you may also want to set this new environment as the Canopy-wide default (EDM Environment to use).

Alternatively, you can download and install a Python-3-default copy of Canopy from Enthought's web site.

If you use separate Python 2 and Python 3 environments, you can easily choose between them via Picking the default Python installation, above.

Installing Python packages


This section assumes you are using Enthought Canopy. The approach for other Python installations involves similar concepts, but the details may be different.

In Getting Started we saw how to get access to the features in the "NumPy" array package by using a Python import statement:

>>> import numpy

This is a big part of what makes Python such a useful platform for science and engineering... in addition to NumPy, there are literally tens of thousands of "packages" available which you can import and start using. These range from image- and video-processing packages like OpenCV to analytics and statistical tools like pandas, an extremely popular Python library for big-data analytics.

Before you can import one of these packages, it will need to be installed into Python. Enthought Canopy comes with a curated, well-tested set of Python packages which can be easily installed using the Package Manager.

To install Python packages, launch the Package Manager from the Canopy welcome screen:


Then, you can search for and select Python packages to install, using a graphical package browser:


Learning Python

Useful Python packages

  • Numpy: the fundamental package for scientific computing with Python.
  • SciPy: provides many user-friendly and efficient numerical routines.
  • matplotlib: a Python 2D plotting library.
  • iPython / Jupyter: interactive computing with Python.
  • pandas: high-performance, easy-to-use data structures & data analysis tools
  • scikit-learn: machine learning in Python.
  • scikit-image: image processing in Python.
  • requests: Python HTTP for humans.
  • SQLAlchemy: database abstraction library.