How to install Win32 extension for Python for Maya 2012


 You might have two different versions of Maya2012 on your machine.
    1. Maya 2012 64 bit
    2. Maya 2012 32 bit
1. First, we will have to grab correct win32com library for Maya version. Following are the link for different versions .


For Maya 2012 64 bit  => win32com for python 2.6 64 bit.
For Maya 2012 32 bit  => win32com for python 2.6 32 bit.

2. Installation of these libraries will also require Python standalone installation, which you can get from  python.org website.
  1. Python 2.6 64 bit ( compatible to Maya 2012 64 bit )
  2. Python 2.6 32 bit ( compatible to Maya 2012 32 bit )

3. After you would install python standalone, your installed win32com library would go in following directory :
C:\Python26_64bit\Lib\site-packages

Add above path in your system paths by executing following commands in Maya.

import sys                                                                         
sys.path.append("C:/Python26_64bit/Lib/site-package")

If at this point you will try to import win32com ( import win32com) in Maya you will see errors like :

# ImportError: No module named win32api #
# ImportError: No module named pywintypes #

For fixing these errors, add following two more paths in system-path.

sys.path.append("C:/Python26_64bit/Lib/site-package/win32")
sys.path.append("C:/Python26_64bit/Lib/site-package/win32/lib")

Now, you should be all set to use win32com library.



Summary :

1. Install standalone python.
2. Install win32com library.
3. add following system paths.
sys.path.append("C:/Python26_64bit/Lib/site-package")
 sys.path.append("C:/Python26_64bit/Lib/site-package/win32")
sys.path.append("C:/Python26_64bit/Lib/site-package/win32/lib") 
4. Import win32com.






Comments

Popular posts from this blog

Bounding Box in PIL (Python Image Library)

Dictionary vs KeyValuePair vs Struct - C#

Rendering order and Z-sorting