From BlenderWiki
Downloading Python
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.
Win95,98,Me
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:
SET PYTHONPATH=C:\PYTHON22;C:\PYTHON22\DLLS;C:\PYTHON22\LIB;C:\PYTHON22\LIB\LIB-TKand reboot the system.
WinNT,2000,XP
Once you have installed Python in, say, C:\PYTHON22, go on the “My Computer” icon on the desktop, click RMB
and select Properties. Select the Advanced tab and press the Environment Variables button.
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:
C:\PYTHON22;C:\PYTHON22\DLLS;C:\PYTHON22\LIB;C:\PYTHON22\LIB\LIB-TK
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.
Note
Even though the
PYTHONPATH environment variable is not defined, Blender seems to have no problem finding Python, when both have been installed with the package system of the distribution. Probably because Python is in a standard place (e.g. /usr/lib/python2.5). |