python - 操作系统: Maya Python Qt conflict with system libraries

标签 python macos qt maya

我正在尝试解决导致 Maya 崩溃的 Qt 库冲突问题。当我从终端运行 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.

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

/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 # 

最佳答案

我今天也遇到了同样的问题,已经解决了。所以这可能会有所帮助。

首先从 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 返回的文件夹列表即可。

希望对你有帮助

关于python - 操作系统: Maya Python Qt conflict with system libraries,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33802033/

相关文章:

python - 当一个模块被导入两次时会发生什么?

python - Xcode Playground 因非 swift 代码而崩溃

java - swt/rmi java 应用程序在 mac/OSX 上无法正常关闭

python - 如何在 IIS 上为 Python2.7 正确安装 isapi_wsgi?

javascript - 通过 python 脚本发送包含 javascript 的动态 html 电子邮件

python - 区分curses中的^J和<Enter>

macos - iTerm2 "Cmd + Click"打开文件在 Tmux session 下不起作用

c++ - 将指针附加到 QList

c++ - Qt创建游戏主机

c++ - setStyleSheet 固定字体,不再更新字体传播