Using the Python Distribution for Ice 3.7.0

This page provides important information for users of the Ice for Python distribution.

On this page:

Overview of the Ice for Python Distribution

Ice for Python is available as a collection of Python packages on the Python Package Index. Each package provides the following:

  • Ice extension for Python
  • Slice files for all Ice components (Glacier2, Ice, IceGrid etc.)
  • Slice-to-Python compiler (slice2py)

The binary distributions for Linux also include Python packages.


Installing the Ice for Python Distribution

Install Ice for Python using the pip source distribution. The following command will build and install the source package.:

pip install zeroc-ice

On Linux this command will build and install the source package. On macOS and Windows it installs a pre-built wheel for the following configurations:

  • Python 2.7 on macOS (64 bit) and Windows (32 bit and 64 bit) 
  • Python 3.6 on Windows (32 bit and 64 bit)

Using Ice for Python

The installation process automatically adds the Ice modules to Python's package directory and adds the Slice-to-Python compiler (slice2py) to a directory that's likely already in your executable search path. To verify that Ice is installed, execute these commands:

python
>>> import Ice
>>> Ice.getSliceDir()

The output of getSliceDir shows where the Slice files have been installed.

The Ice manual provides a complete description of the Python mapping, including the options for generating Python code from Slice definitions.

 

Using the Sample Programs

Sample programs are provided in a separate GitHub repository. You can browse this repository to see build and usage instructions for all supported programming languages. Simply clone this repository:

git clone -b 3.7 https://github.com/zeroc-ice/ice-demos.git
cd ice-demos