Sunday, August 4, 2013

How do I change the python version in Maya?

Basically, the article can be summed up into 3 steps:
  1. Create an environment variable PYTHONHOME and set it to point to the version of Python you want (e.g. C:\Python27).
  2. Copy the files from your "MayaDirectory"\Python\Lib\site-packages (e.g. C:\Program Files (x86)\Autodesk\Maya2013\Python\Lib\site-packages) and paste them in "PYTHONHOME"\Lib\site-packages (e.g. C:\Python27\Lib\site-packages).
  3. Restart Maya and see if everything works! You can check which Python is being used by running (from Maya's 'Script Editor'):
    import sys
    print sys.prefix
Pay special attention to the 2nd step where the article underlines how to make Maya's libraries work after you change your environment variable. Note that print statements might start appearing in your 'Output Window' instead of the 'Script Editor' if you haven't done this last step correctly.
However, it's possible to change that by setting the PYTHONHOME environment variable. The following article explains how to do that and how to check that it's setup correctly: