Choose Python Inside Maya

If no PYTHONHOME is set, run below inside Maya:

import sys
print sys.prefix

returns /Python dir inside Maya install location.

Now let PYTHONHOME=”C:\\python26″, where stand-along python is installed. Run the same lines in Maya, we get:

c:\python26

So we explicitly choose the version of Python to work inside Maya. But there is something confusing about this Python. If you run

sys.version

It will appear to be different from the version running outside Maya. Run

sys.path

to check module search path. It will start will Maya /bin dir. While Python outside starts searching modules in C:\\windows\\system32

Another issue is Maya still need Python to load Maya modules. There is a /maya dir inside Maya\\Python\\Lib\\site-packages, copy it into C:\\python26\\Lib\\site-packages, so Python can find the modules.

About these ads

Leave a comment

Filed under Python

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s