PySide is a Python module that extends the capabilities of graphical user interface (UI) development. The license allows its use in both open and closed and commercial projects. The PySide module is not included in the basic Blender distribution, but it is not difficult to install it manually.
To install the PySide module in Blender:
1. Run Blender with full rights (“run as Administrator” on Windows, or with root rights on Linux)
2. Open the Text Edit area.
3. Paste the following code into it:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
import subprocess import sys import os python_exe = os.path.join(sys.prefix, 'bin', 'python.exe') target = os.path.join(sys.prefix, 'lib', 'site-packages') subprocess.call([python_exe, '-m', 'ensurepip']) subprocess.call([python_exe, '-m', 'pip', 'install', '--upgrade', 'pip']) subprocess.call([python_exe, '-m', 'pip', 'install', '--upgrade', 'pyside6', '-t', target]) print('PySide6 installed') |
Here, we first define the directory where the PySide module will be installed – in the Blender installation directory.
Next, we call the pip update command, after which we call the PySide installation command. The currently last version of PySide is the sixth, so we specify the “pyside6” package name.
4. Run this code by pressing the “Run Script” button with the arrow.
You can monitor the installation progress through the Blender system console (main menu – Window – Toggle System Console).
After the installation is complete, we can import the PySide module and use it. For example, print the version of the module we installed to the console:
1 2 3 4 5 |
import PySide6 print('PySide current version is:', PySide6.__version__) # PySide current version is: 6.8.0.1 |