Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 4148

How do I add a library to RhinoPython?

$
0
0

@shepherdpg wrote:

I am interested in learning how to access non-standard python libraries from within RhinoPython (not GH Python). Specifically I am trying to use the PIL library, but I am assuming my problem is not limited to PIL. I have the PIL library installed in my regular python and in anaconda and can access it in python scripts but cannot access it from RhinoPython. I do not have IronPython installed separately, other than via Rhino, so I cannot install PIL via something like:
ipy -X:Frames -m pip install PIL
from the command-line because “ipy” is not a recognised command and there isn’t an “ipy” executable inside the C:\Program Files\Rhino 6\Plug-ins\IronPython folder.

The python code I would like to run is along the lines of:
from PIL import Image
my_image = Image.open(my_image_path, ‘r’)
However, I get the runtime error message “No module named PIL” in the EditPythonScript debug console.

I have downloaded the python 2.7 version of PIL from here:
https://www.pythonware.com/products/pil/
and extracted the PIL folder to C:\Program Files\Rhino 6\Plug-ins\IronPython\Lib\site-packages
I have added the folder to the ModuleSearchPaths list in the EditPythonScript Options dialog box.

Can anyone give a quick overview of how to add external python packages to Rhino’s IronPython subsystem?

Posts: 19

Participants: 4

Read full topic


Viewing all articles
Browse latest Browse all 4148

Trending Articles