How to install SIP & PyQT on windows 7

前端 未结 3 480
醉酒成梦
醉酒成梦 2020-11-30 05:33

I\'m a newbie to Python environment & really struggling to install SIP & PyQt on my Win 7 machine.

This is what I\'ve done so far,

  1. I\'
3条回答
  •  盖世英雄少女心
    2020-11-30 05:58

    This is for all that want to build PyQt4 with latest Qt4 and Python 3.4.x.

    Download Visual Studio 2010 from here: http://download.cnet.com/Microsoft-Visual-Studio-2010-Ultimate/3000-2383_4-75450998.html

    then install it.

    Download SIP source code (in my case version 4.19.5) from here: https://www.riverbankcomputing.com/software/sip/download

    Download PyQt4 source code (in my case version 4.12.1) from here: https://www.riverbankcomputing.com/software/pyqt/download

    Extract SIP and PyQt .zip archive in \Users\your_username\Desktop\compilation\

    Download latest Qt 4.x (vs2010 version) installer from here: http://download.qt.io/archive/qt/

    Install Qt (in my case qt-opensource-windows-x86-vs2010-4.8.6.exe).

    Open a command prompt (use this one for all the process) and execute these commands:

    cd \Users\\Desktop\compilation\sip-4.19.5
    python configure.py
    "C:\Qt\4.8.6\bin\qtvars.bat"
    

    In the output take note of QMAKESPEC value, in my case win32-msvc2010, then use it later on --spec option for PyQt4 configure-ng script.

    If the current directory has been changed, execute again:

    cd \Users\\Desktop\compilation\sip-4.19.5
    

    Now, if you use 64-bit version of Python execute:

    "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"
    

    otherwise, if you use 32-bit version of Python execute:

    "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\vcvars32.bat"
    nmake
    nmake install
    cd \Users\\Desktop\compilation\PyQt4_gpl_win-4.12.1
    

    Now use previous QMAKESPEC value in --spec option:

    python configure-ng.py --spec win32-msvc2010
    nmake
    nmake install
    

    That's all ;-)

    NOTE: in some cases, in order to avoid this error

    ImportError: DLL load failed: The specified procedure could not be found.
    

    it is necessary to copy .dll files from

    C:\Qt\4.8.6\bin
    

    to

    C:\Python34\Lib\site-packages\PyQt4
    

提交回复
热议问题