IC Python API:Python Extension Libraries

From Reallusion Wiki!
Revision as of 01:15, 7 January 2019 by Chuck (RL) (Talk | contribs) (Created page with "{{TOC}} {{Parent|IC_Python_API|iClone Python API}} iClone ships with a pre-built version of PySide 2.0, and is the preferred library for using QT with Python in iClone . You...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Main article: iClone Python API.

iClone ships with a pre-built version of PySide 2.0, and is the preferred library for using QT with Python in iClone . You may install other CPython extension libraries as well. However, while every effort has been made to ensure that CPython extension libraries such as SciPy, NumPy, PIL, and so forth work with Python in iClone, Reallusion does not provide technical support for them.

If you do want to use a CPython extension library, you must have the 64-bit binaries compiled using the same versions of Qt and Python that are used by iClone. These are Qt 5.6.2 and Python 3.6.2. Compiled extension libraries must then be placed at a location that can be found by Python. Python uses the list of directories in the sys.path global variable to find the location of imported Python scripts and extension modules.

Installing PIP for Package Management

What's PIP?

Pip is a package management system for Python. It is useful for managing additional Python modules, including managing building modules from source (for example, NumPy). For libraries that contain pre-built binaries (such as pyzmq), you will need to obtain the source and re-build the binaries, replacing the ones installed by PIP. By default, PIP will try to use pre-built binaries. You can force PIP to build from source with the "--no-binary" flag, and specifying a required version.

What's a Package?

A package contains all the files you need for a module.

Modules are Python code libraries you can include in your project.

Setting iClone Python Environment Variables

You can point iClone Python to another directory to look for modules and packages. On Windows, go to:

My Computer > Properties > Advanced System > Settings > Environment Variables

Installing PIP

Close iClone then open Windows Command line and enter:
iClonepy <iClone Install Path>\Bin64\scripts\Python\get-pip.py

You should be able to acquire any module you want on PIP, such as NumPy, Requests, Pygame, Tensorflow etc.

Let's say, you want to install Numpy, just type and enter:
iClonepy -m pip install NumPy
Python api numpy.png