Skip to content

Instantly share code, notes, and snippets.

@AndresMWeber
Last active December 13, 2018 07:21
Show Gist options
  • Save AndresMWeber/a1ff0c97f81b4bac86a975ee0f43a4ed to your computer and use it in GitHub Desktop.
Save AndresMWeber/a1ff0c97f81b4bac86a975ee0f43a4ed to your computer and use it in GitHub Desktop.
Execute Python as Mayapy
import os
import sys
#https://knowledge.autodesk.com/support/maya/learn-explore/caas/CloudHelp/cloudhelp/2016/ENU/Maya/files/GUID-C0F27A50-3DD6-454C-A4D1-9E3C44B3C990-htm.html
#======================================================#
#THESE ARE THE MISSING STUFF FOR SIMULATING mayapy.exe ENV
#======================================================#
os.environ["MAYA_LOCATION"] = "C:\\Program Files\\Autodesk\\Maya2017"
os.environ["PYTHONHOME"] = "C:\\Program Files\\Autodesk\\Maya2017\\Python"
os.environ["PATH"] = "C:\\Program Files\\Autodesk\\Maya2017\\bin;" + os.environ["PATH"]
sys.path.append('C:\Program Files\Autodesk\Maya2017\Python\Lib\site-packages\setuptools-18.1-py2.7.egg')
sys.path.append('C:\Program Files\Autodesk\Maya2017\bin\python27.zip')
sys.path.append('C:\Program Files\Autodesk\Maya2017\bin')
sys.path.append('C:\Program Files\Autodesk\Maya2017\Python')
sys.path.append('C:\Program Files\Autodesk\Maya2017\Python\Lib\site-packages')
sys.path.append('C:\Program Files\Autodesk\Maya2017\Python\Lib')
sys.path.append('C:\Program Files\Autodesk\Maya2017\Python\DLLs')
# Local extraction of python27.zip for command completion in PyCharm CE 2016
sys.path.append('C:\Users\andre\Documents\maya\libmayapy')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment