我试图在Python(IDLE)中导入maya.standalone
。我声明了环境变量,但仍然得到下面的错误。
import maya.standalone ImportError: DLL load failed: The specified module could not be found.
下面是我的代码:
import os,sys from PyQt4
os.environ["MAYA_LOCATION"] = "C:\Program Files\Autodesk\Maya2014"
os.environ["PYTHONHOME"] = "C:\Program Files\Autodesk\Maya2014\Python"
os.environ["PATH"] = "C:\Program Files\Autodesk\Maya2014\bin;" + os.environ["PATH"]
sys.path.append("C:\Program Files\Autodesk\Maya2014\bin")
sys.path.append("C:\Program Files\Autodesk\Maya2014\bin\python27.zip")
sys.path.append("C:\Program Files\Autodesk\Maya2014\Python")
sys.path.append("C:\Program Files\Autodesk\Maya2014\Python\DLLs")
sys.path.append("C:\Program Files\Autodesk\Maya2014\Python\lib")
sys.path.append("C:\Program Files\Autodesk\Maya2014\Python\lib\site-packages")
sys.path.append("C:\Program Files\Autodesk\Maya2014\Python\Lib\site-packages\maya")
import maya.standalone
maya.standalone.initialize(name='python')
如何修复此错误?
您必须使用mayapy而不是python来导入该模块。添加到您的路径"C:Program FilesAutodeskMaya2014bin;"
然后在windows命令中输入:
mayapy
import maya.standalone