一半君的总结纸

听话只听一半君

手贱破笔记本重装系统CentOS 6.5 续 – 编译Maya 2015的能用的PyQt4

lz果然手贱,都装好了才想起以前为何不用centos,因为repo里没有现成的PyQt4 for maya,都太老了,我了个大擦

yum从repo里装出来的PyQt4版本是 4.6.2,python是2.6.6

>>> import PyQt4.QtCore as QtCore
>>> QtCore.PYQT_VERSION_STR
'4.6.2'

而根据Maya 2011-2015的PyQt Windows7 Linux Mac OSX 国外大神屌丝编译版大合集里的总结,Maya 2015用的是PyQt是4.10.4(对应的Qt是4.8.5)

lz感觉应该不能用才对啊,点解一点问题没有?不知道何故,不管了,反正能用就好

edit: 但还是手痒想compile个”恰好”对应的版本试试
根据官方说明,现在除非有特殊需要,已经不需要再自己编译Qt了,因为Maya 2015已经自带了libxml, openSSL, OpenAL, python2.7, qt-4.8.5-64等需要的package.

按官网pdf操作即可,大致步骤如下

  1. 添加 MAYA_LOCATION 环境变量,我加到了~/.bashrc里

    MAYA_LOCATION=/usr/autodesk/maya2015-x64
    export MAYA_LOCATION
    
  2. 把/usr/autodesk/maya2015-x64/bin/qt.conf的内容改成如下所示

    [Paths]
    Prefix=
    Libraries=../lib
    Binaries=../bin
    Headers=../include/Qt
    Data=../
    Plugins=../qt-plugins
    Translations=../qt-translations
    
  3. 把/include/qt-4.8.5-include.tar.gz 的内容解到 /include/Qt
  4. 把/mkspecs/qt-4.8.5-mkspecs.tar.gz 的内容解到 /mkspecs
  5. Build & Install SIP

    #!/usr/bin/env bash
     
    MAYAQTBUILD="`dirname \"$0\"`" # Relative
    export MAYAQTBUILD="`( cd \"$MAYAQTBUILD\" && pwd )`" # Absolutized and normalized
    cd $MAYAQTBUILD
     
    export SIPDIR=$MAYAQTBUILD/sip-4.16.2
    export MAYA_LOCATION=/usr/autodesk/maya2015-x64
     
    cd $SIPDIR
    $MAYA_LOCATION/bin/mayapy ./configure.py
    make
    sudo make install
    
  6. Build & Install PyQt

    #!/usr/bin/env bash
     
    MAYAQTBUILD="`dirname \"$0\"`" # Relative
    export MAYAQTBUILD="`( cd \"$MAYAQTBUILD\" && pwd )`" # Absolutized and normalized
    cd $MAYAQTBUILD
     
    export MAYA_LOCATION=/usr/autodesk/maya2015-x64
    export QTDIR=$MAYA_LOCATION
    export QMAKESPEC=$QTDIR/mkspecs/linux-g++-64
    export INCDIR_QT=$MAYA_LOCATION/include/Qt
    export LIBDIR_QT=$QTDIR/lib
     
    if [ ! -f $QMAKESPEC/qmake.conf ];
    then
      echo "You need to install qt-4.8.5-mkspecs.tar.gz in $QTDIR/mkspecs !"
      exit
    fi
    if [ ! -f $INCDIR_QT/QtCore/qdir.h ];
    then
      echo "You need to uncompress $MAYA_LOCATION/include/qt-4.8.5-include.tar.gz in $INCDIR_QT !"
      exit
    fi
    # qt.conf - /Applications/Autodesk/maya2015/Maya.app/Contents/Resources
    if [ ! -f $QTDIR/bin/qt.conf ];
    then
      echo "You need to copy $QTDIR/Resources/qt.conf in $QTDIR/bin !"
      exit
    fi
     
    test=`grep "Headers=../include/Qt" $QTDIR/bin/qt.conf`
    if [ -z "$test" ];
    then
      echo "You need to edit $QTDIR/bin/qt.conf to use 'Headers=../include/Qt'"
      exit
    fi
     
    export SIPDIR=$MAYAQTBUILD/sip-4.16.2
    export PYQTDIR=$MAYAQTBUILD/PyQt-x11-gpl-4.11.1
     
    cd $PYQTDIR
    export PATH=$QTDIR/bin:$PATH
    $QTDIR/bin/mayapy ./configure.py LIBDIR_QT=$LIBDIR_QT INCDIR_QT=$INCDIR_QT MOC=$QTDIR/bin/moc -w --no-designer-plugin -g
    make -j 8
    sudo make install
    

中间找不到g++410 gcc410,如下乱蒙…

sudo ln -s /usr/bin/g++ /usr/bin/g++410
sudo ln -s /usr/bin/gcc /usr/bin/gcc410

之后,世界和谐了
pyqt

我把我编译好的文件放在这里

参考:
官方说明pdf PyQt for Autodesk Maya 2015 64bit

抄袭:
Building SIP, and PyQt for Maya 2015

Adventures with PyQt in Maya – Part 1

Advertisements

发表评论

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s

%d 博主赞过: