【问题标题】:error while importing maya.standalone in nuke在 nuke 中导入 maya.standalone 时出错
【发布时间】:2026-02-16 05:55:01
【问题描述】:

我正在考虑编写一个脚本,该脚本将以独立模式打开 maya,并从 nuke 中列出 maya 中灯光的某些属性。为此,我需要导入 maya.standalone 模块并使用 mayapy 打开文件,使用 subprocess 模块调用外部 shell 命令。老实说,我不确定这是否是从 nuke 执行此操作的正确方法。太好了,如果有人能指出什么,我做错了。

import sys
mayaLibPath="C:\Program Files\Autodesk\Maya2014\Python\Lib\site-packages"
mayaDllPath="C:\Program Files\Autodesk\Maya2014\Python\DLLs"
sys.path.append(mayaLibPath)
sys.path.append(mayaDllPath)
import maya.cmds
import maya.standalone

当我在上面运行脚本时出现以下错误。 回溯(最近一次通话最后): 文件“”,第 7 行,在 ImportError: DLL load failed: 找不到指定的过程。

干杯!!

【问题讨论】:

    标签: python-2.7 nuke


    【解决方案1】:

    使用字符串文字时,您需要转义反斜杠。您也可以用正斜杠代替。但是反斜杠本身就是一个转义字符,例如\n\t

    import sys
    mayaLibPath="C:\\Program Files\\Autodesk\\Maya2014\\Python\\Lib\\site-packages"
    mayaDllPath="C:\\Program Files\\Autodesk\\Maya2014\\Python\\DLLs"
    sys.path.append(mayaLibPath)
    sys.path.append(mayaDllPath)
    import maya.cmds
    import maya.standalone
    

    【讨论】:

    • 感谢您指出这一点:)。但这仍然不能解决问题...它仍然显示相同的 dll 加载失败错误。