OSX: Maya Python Qt与系统库冲突

2 投票
1 回答
673 浏览
提问于 2025-05-10 15:16

我正在尝试解决一些冲突的Qt库,这些库导致Maya崩溃。当我从终端运行Maya时,我得到了:

objc[4152]: Class QCocoaColorPanelDelegate is implemented in both /Applications/Autodesk/maya2016/Maya.app/Contents/MacOS/QtGui and /usr/local/lib/QtGui.framework/Versions/4/QtGui. One of the two will be used. Which one is undefined.
objc[4152]: Class QMacSoundDelegate is implemented in both /Applications/Autodesk/maya2016/Maya.app/Contents/MacOS/QtGui and /usr/local/lib/QtGui.framework/Versions/4/QtGui. One of the two will be used. Which one is undefined.
objc[4152]: Class QCocoaPanel is implemented in both /Applications/Autodesk/maya2016/Maya.app/Contents/MacOS/QtGui and /usr/local/lib/QtGui.framework/Versions/4/QtGui. One of the two will be used. Which one is undefined.
objc[4152]: Class QCocoaView is implemented in both /Applications/Autodesk/maya2016/Maya.app/Contents/MacOS/QtGui and /usr/local/lib/QtGui.framework/Versions/4/QtGui. One of the two will be used. Which one is undefined.
objc[4152]: Class QCocoaWindow is implemented in both /Applications/Autodesk/maya2016/Maya.app/Contents/MacOS/QtGui and /usr/local/lib/QtGui.framework/Versions/4/QtGui. One of the two will be used. Which one is undefined.
objc[4152]: Class QCocoaWindowDelegate is implemented in both /Applications/Autodesk/maya2016/Maya.app/Contents/MacOS/QtGui and /usr/local/lib/QtGui.framework/Versions/4/QtGui. One of the two will be used. Which one is undefined.
objc[4152]: Class QCocoaMenuLoader is implemented in both /Applications/Autodesk/maya2016/Maya.app/Contents/MacOS/QtGui and /usr/local/lib/QtGui.framework/Versions/4/QtGui. One of the two will be used. Which one is undefined.
objc[4152]: Class QNSApplication is implemented in both /Applications/Autodesk/maya2016/Maya.app/Contents/MacOS/QtGui and /usr/local/lib/QtGui.framework/Versions/4/QtGui. One of the two will be used. Which one is undefined.
objc[4152]: Class QCocoaApplicationDelegate is implemented in both /Applications/Autodesk/maya2016/Maya.app/Contents/MacOS/QtGui and /usr/local/lib/QtGui.framework/Versions/4/QtGui. One of the two will be used. Which one is undefined.
objc[4152]: Class QCocoaWindowCustomThemeFrame is implemented in both /Applications/Autodesk/maya2016/Maya.app/Contents/MacOS/QtGui and /usr/local/lib/QtGui.framework/Versions/4/QtGui. One of the two will be used. Which one is undefined.
objc[4152]: Class QCocoaToolBarDelegate is implemented in both /Applications/Autodesk/maya2016/Maya.app/Contents/MacOS/QtGui and /usr/local/lib/QtGui.framework/Versions/4/QtGui. One of the two will be used. Which one is undefined.
objc[4152]: Class QCocoaMenu is implemented in both /Applications/Autodesk/maya2016/Maya.app/Contents/MacOS/QtGui and /usr/local/lib/QtGui.framework/Versions/4/QtGui. One of the two will be used. Which one is undefined.
objc[4152]: Class QNSOpenSavePanelDelegate is implemented in both /Applications/Autodesk/maya2016/Maya.app/Contents/MacOS/QtGui and /usr/local/lib/QtGui.framework/Versions/4/QtGui. One of the two will be used. Which one is undefined.
objc[4152]: Class QCocoaFontPanelDelegate is implemented in both /Applications/Autodesk/maya2016/Maya.app/Contents/MacOS/QtGui and /usr/local/lib/QtGui.framework/Versions/4/QtGui. One of the two will be used. Which one is undefined.
objc[4152]: Class QNSPanelProxy is implemented in both /Applications/Autodesk/maya2016/Maya.app/Contents/MacOS/QtGui and /usr/local/lib/QtGui.framework/Versions/4/QtGui. One of the two will be used. Which one is undefined.
objc[4152]: Class QNSWindowProxy is implemented in both /Applications/Autodesk/maya2016/Maya.app/Contents/MacOS/QtGui and /usr/local/lib/QtGui.framework/Versions/4/QtGui. One of the two will be used. Which one is undefined.
objc[4152]: Class QCocoaPageLayoutDelegate is implemented in both /Applications/Autodesk/maya2016/Maya.app/Contents/MacOS/QtGui and /usr/local/lib/QtGui.framework/Versions/4/QtGui. One of the two will be used. Which one is undefined.
objc[4152]: Class QCocoaPrintPanelDelegate is implemented in both /Applications/Autodesk/maya2016/Maya.app/Contents/MacOS/QtGui and /usr/local/lib/QtGui.framework/Versions/4/QtGui. One of the two will be used. Which one is undefined.
objc[4152]: Class QNSImageView is implemented in both /Applications/Autodesk/maya2016/Maya.app/Contents/MacOS/QtGui and /usr/local/lib/QtGui.framework/Versions/4/QtGui. One of the two will be used. Which one is undefined.
objc[4152]: Class QNSStatusItem is implemented in both /Applications/Autodesk/maya2016/Maya.app/Contents/MacOS/QtGui and /usr/local/lib/QtGui.framework/Versions/4/QtGui. One of the two will be used. Which one is undefined.
objc[4152]: Class QNSMenu is implemented in both /Applications/Autodesk/maya2016/Maya.app/Contents/MacOS/QtGui and /usr/local/lib/QtGui.framework/Versions/4/QtGui. One of the two will be used. Which one is undefined.

我的解决办法是隐式地设置PYTHONPATH环境变量,指向Qt库:

/Applications/Autodesk/maya2016/Maya.app/Contents/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages

但这导致其他使用Qt的应用程序链接到了Maya的自定义Qt版本,产生了另一个冲突(不同的版本和Python版本)。

我猜这可能是个OSX特有的问题。怎么才能让应用程序使用它们自己的Qt库呢?

编辑:我卸载了通过brew安装的Qt、PySide和Shiboken包,以检查它们是否被Maya使用。没有设置PYTHONPATH的情况下,PySide仍然是从系统目录中被找到的:

import PySide
PySide.__file__
# Result: /usr/local/lib/python2.7/site-packages/PySide/__init__.pyc # 

相关文章:

  • 暂无相关问题
暂无标签

1 个回答

2

我今天也遇到了同样的问题,并且解决了它。希望这些信息能对你有帮助。

首先,检查一下在Maya里面的sys.path:

for p in sys.path:
    print p

你应该会看到它错误地列出了 /usr/local/lib/python2.7/site-packages/

出现这个问题的原因有几个:

  • 你在你的个人配置文件(比如.bashrc、.profile、.zshrc等)中设置了 PYTHONPATH,然后从命令行运行Maya。在这种情况下,你有两个选择。要么从个人配置文件中删除PYTHONPATH,要么在运行Maya之前添加一个别名来处理这个问题,

    可以这样写: alias maya=export PYTHONPATH="";/App/Maya/macos/maya

  • 你可能在某个地方有一个 .pth 文件,它链接到了 /usr/local/lib/python2.7/site-packages/。只需检查一下sys.path返回的文件夹列表。

希望这些信息能帮到你

撰写回答