Starting the CPLEX Python API

Use the script setup.py (supplied with the product) to get started with the CPLEX Python API on your system.

In this tutorial, the directory where you find the CPLEX Python API (for example, as a feature of your installation of IBM ILOG CPLEX Optimization Studio) is known as yourCPLEXhome. In a path, such as yourCPLEXhome/python/VERSION/PLATFORM or yourCPLEXhome\python\VERSION\PLATFORM, VERSION specifies one of the versions of Python compatible with CPLEX and PLATFORM represents the name of one of the various platforms on which the CPLEX Python API is available. In this context, a platform is a combination of operating system (such as a Microsoft Windows designation or a GNU/Linux distribution) and chip-type (such as 32- or 64-bit architecture) for which CPLEX is distributed as a feature. In that directory, you find these elements:

  • a subdirectory named cplex

  • a file named setup.py

Before you start this tutorial, you need to use that script to make your Python installation aware of your CPLEX installation. For more detail about using that script, see Setting up the Python API of CPLEX.