To have access to the standard Python modules you need a complete working Python install. You can download this from the Python web site.
Setting the PYTHONPATH environment variable
Be sure to check on Blender web site which is the exact Python version which was built into Blender to prevent compatibility issues. Blender must also be made aware of where this full Python installation is. This is done by defining a
PYTHONPATH environment variable.
Once you have installed Python in, say,
C:\PYTHON22, you must open the file
C:\AUTOEXEC.BAT with your favourite text editor, add a line:
and reboot the system.
Below the System Variables box (the second one), hit New. If you are not an administrator you might be unable to do that. In this case hit New in the upper box.
Now, in the Variable Name box, type
PYTHONPATH, and in the Variable Value box,type:
Hit OK repeatedly to exit from all dialogs. You may or may not have to reboot, depending on the OS.
Linux and other UNIXes
Normally you will have Python already there. If not, install it. You will have to discover where it is. This is easy, just start a Python interactive shell by opening a shell and by typing
python in there. Type the following commands:
>>> import sys >>> print sys.path
and note down the output, it should look like:
['', '/usr/local/lib/python2.2', '/usr/local/lib/python2.2/plat-linux2', '/usr/local/lib/python2.0/lib-tk', '/usr/local/lib/python2.0/lib-dynload', '/usr/local/lib/python2.0/site-packages']
Add this to your favorite
rc file as an environment variable setting. For example, add in your
.bashrc the line:
export PYTHONPATH=/usr/local/lib/python2.2:/usr/local/lib/python2.2/plat-linux2: /usr/local/lib/python2.2/lib-tk:/usr/local/lib/python2.2/lib-dynload: /usr/local/lib/python2.0/site-packages
(warning: all on a single line). Open a new login shell, or logout and login again.
Even though the