Why settle for one Python when you can have two

September 22nd, 2008 by Patrick Boucher - Viewed 7853 times -

For the first time I was confronted this week with running XSI 32bits and XSI 64bits on the same Windows x64 system. I’d tried it in the past just as a challenge to get it to work but now the crew I was working with actually had some production needs for it.

It was so simple I can probably qualify it as being the biggest non event of my past few months… This same subject has been talked about a few times in the past but because historically it has been so complicated (read impossible), I thought I’d rehash it here. Here are some no nonsense steps to make it happen:


  • Install your two different Pythons in two different directories (I used C:\Python26-x86 and C:\Python26-x64)
  • Python 2.6 is at RC2 as of this writing but is very solid. Release shoudn’t be too far off (scheduled for Oct 1st).
  • For Vista users, turn UAC off for these installs.

Now whenever you launch one version or another of XSI you should set the system path to include the path to the appropriate version of Python. One nice way to do this is to use the UserTools to edit setenv.bat and add a line like the following at the top of the file:

set PATH=C:\Python26-x64;%PATH%

This is also a nice place to set your PYTHONPATH environment variable for any custom libraries as well. Most libs you develop yourself are likely to be 100% pure Python. As such they are usable by both the 32 and 64 bit interpreters and can be kept in a single central location and included by both versions. Some libraries that you download might require specific binary builds and you’ll need to install those twice, one for each Python version.

Why am I talking specifically about Python 2.6 even if it is only at RC2? I’m a strong advocate of moving to this new version as soon as you can, given any libraries you need for your tools are also available for the new version. This version adds or implements a lot of stuff that will be in Python 3.0 without breaking 2.x compatibility (too much). As such it becomes a great way to smooth your transition to the future version of the language. If you want to get up to speed with what is coming up in Python 2.6, you can check it out here.

Have fun!

One Response to “Why settle for one Python when you can have two”

  1. MindWin says:

    I will learn Python, and will try to use it in XSI.