Using the Python Distribution

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 components:

  • Ice extension for Python
  • Standard Slice files
  • Slice-to-Python compiler (slice2py)


Installing the Ice for Python Distribution

Install Ice for Python using this command:

 pip install zeroc-ice==3.6.4

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 standard 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 and use its 3.6 branch:

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