External Actions
Execute external shell commands from Blender via the subprocess module:
import os, sys, subprocess
# open a command prompt in the Blender install directory
subprocess.run(["start", "cmd.exe", os.getcwd()], shell=True)
# Open an explorer window in the Blender instlal directory
subprocess.run(["explorer.exe", os.getcwd()])
Python Libraries
To install external libraries in Blender Python, you need to ensure PIP is available:
.\python -m ensurepip --default-pip
Once that is assured, you can install any library like this (Pillow as an example):
.\python -m pip install Pillow
After that you can use the lib in any script:
From PIL import image
# ...
Useful libraries for Python
- Pillow: Various image related functionality
- PySide: Additional UI functionality