# Python content moved from UL Help to the Download page on GitHub

## From the Getting Started Topic

### Installing the MCC UL Python API for Windows

1. Install Python version 2.7, 3.4, or later from www.python.org.
2. Install the latest version of InstaCal from www.mccdaq.com.
3. Install the MCC UL Python API for Windows and any dependencies using pip:

1. Open the Windows command prompt: press Win+R, type cmd.exe and press Enter.
2. Upgrade pip to the latest version: type pip install --upgrade pip and press Enter.
   If you get a message like "pip is not recognized as an internal or external command...", or if you have multiple Python installations, enter the full path to the pip executable, such as C:\Python27\Scripts\pip install --upgrade pip. The pip command is in the Scripts subdirectory of your Python install location.
3. Install the mcculw library: type the command pip install mcculw.
   If you get a message similar to "pip is not recognized as an internal or external command...", or if you have multiple Python installations, enter the full path to the pip executable, such as C:\Python27\Scripts\pip install mcculw. The pip command is in the Scripts subdirectory of your Python install location. pip only installs the library for a single Python version. If more than one Python version is installed, use the pip associated with that version.

For instructions on how to import the examples into a supported IDE such as Eclipse or Visual Studio, refer to the Importing Python for Windows example programs into an IDE section of the Universal Library Language Interface topic.

## From the UL Language Interface Topic

##### Software and hardware requirements

- Measurement Computing InstaCal and Universal Library (current versions)
- Python versions 2.7, 3.4 and later
- Microsoft Windows 10/8/7, 32/64-bit
- Eclipse (Neon and later) and Visual Studio (2015 and later)
- Measurement Computing USB, Bluetooth, or Ethernet hardware

##### Both procedures importing the examples to an IDE

### Importing Python for Windows example programs into an IDE

Python for Windows example programs can be imported into any IDE that supports Python, such as Eclipse (Neon and later) or Visual Studio (2015 and later).

Before performing the following steps, install the MCC UL Python API for Windows using the instructions documented in the Getting Started topic.

1. Download the examples from the mcculw GitHub page at github.com/mccdaq.
2. Create a new folder and unzip the examples to the folder location. For this example, the programs are unzipped to C:\Users\Public\Documents\Measurement Computing\DAQ\Python.
3. Perform the procedures below to import the example programs into Eclipse or Visual Studio:

- For Eclipse instructions, click Importing Python for Windows example programs into Eclipse with PyDev.
- For Visual Studio instructions, click Importing Python for Windows example programs into Visual Studio with Python Tools for Visual Studio (PTVS).

#### Importing the Python for Windows example programs into Eclipse with PyDev

Eclipse Neon.3 – Eclipse IDE for Java Developers required. Other versions of Eclipse will be similar. These instructions assume you have already installed Eclipse.

1. Open an Eclipse workspace; close the Welcome page if it opens.
2. Install the PyDev plugin if it is not already installed:
   1. Go to Help»Install New Software; the Install dialog box opens.
   2. Click Add, and enter http://pydev.org/updates.
   3. Select all of the items listed, and follow the prompts to install.
3. Right click in the Package Explorer, and go to New»Project.
   The New Project dialog box opens.
4. Open the PyDev folder, select PyDev Project, and click Next.
5. Enter a name for the new project, such as mcculw examples in the Project name texbox.
6. Under the Project contents area, uncheck Use default and specify the directory where the examples were unzipped, typically C:\Users\Public\Documents\Measurement Computing\DAQ\Python. This path must be exact, since a Python namespace is directly tied to the directory structure.
7. If you haven't done so already, configure the interpreter by clicking the link provided.

1. Select PyDev»Interpreter»Python Interpreter.
2. Click New.
3. Enter a name for this interpreter, such as Python.
4. Browse to the python executable (python.exe) installed on your system, and click OK.
   The necessary files are added to the path.
5. Apply the changes.

8. Click Finish to complete the process.

##### Running the examples

Follow the procedure below to run console-based examples or user interfaced-based Python for Windows example programs.

1. In the PyDev Package Explorer, expand either examples\console or examples\ui folder.
2. Right click on the example you wish to run, hover over Debug As and select Python Run.
3. After running the example once, subsequent runs may be performed by clicking on the Debug button on the toolbar, or by pressing the F11 key on the keyboard.

#### Importing the Python for Windows example programs into Visual Studio with Python Tools for Visual Studio (PTVS)

The following instructions are intended for Visual Studio 2017. Other versions of Visual Studio should be similar. These instructions assume you have already installed Visual Studio 2017 with the PTVS.

1. Open Visual Studio, and select File»New»Project.
   The New Project dialog box opens.
2. Select Python.
3. Select From Existing Python code.
4. Enter a name for the project, such as mcculw examples.
5. In the Location text box, enter the directory where the examples were unzipped, typically C:\Users\Public\Documents\Measurement Computing\DAQ\Python, and click OK. This path must be exact, since Python namespaces are directly tied to the directory structure.
   The Create New Project from Existing Python Code Wizard dialog box opens.
6. Click Finish to complete the wizard.
7. In the Solution Explorer, right click on Search Paths, select …, add the directory where the Python examples were unzipped (typically C:\Users\Public\Documents\Measurement Computing\DAQ\Python), and click Select Folder.

##### Running the examples

User-interface-based examples and console-based examples are installed. Perform the rollowing procedure to run an examply program.

1. From the Solution Explorer, expand either the examples\console or examples\ui folder.
2. Right click on the example you wish to run and choose Set as Startup File.
3. Run the selected example by pressing the Start button on the standard toolbar, or the F5 key on the keyboard.