Python 2.7 cannot import PyQt4

前端 未结 6 1378
無奈伤痛
無奈伤痛 2021-01-04 10:34

I\'ve upgraded to Python 2.7 from Python 2.6 on Ubuntu Maverick Meerkat (10.10) and I\'m unable to import PyQt4.

austin@gerald:~$ python2.7
Python 2.7.0+ (r2         


        
相关标签:
6条回答
  • 2021-01-04 10:39

    Under Ubuntu system, you could install it via apt-get

    apt-get install python-qt4
    
    0 讨论(0)
  • 2021-01-04 10:42

    OSX 10.8.2 tested:

    sudo pip install SIP
    

    got IOError: [Errno 2] No such file or directory: '/tmp/pip-build/SIP/setup.py'

    It's ok then:

    cd /tmp/pip-build/SIP
    sudo python configure.py
    make
    sudo make install
    

    download PyQt from: http://sourceforge.net/projects/pyqt/files/PyQt4/PyQt-4.9.6/PyQt-mac-gpl-4.9.6.tar.gz

    unzip it.

    cd PyQt-mac-gpl-4.9.6
    sudo python configure.py
    make
    

    it will take a while, after make then:

    sudo make install    
    

    Enjoy it :)

    0 讨论(0)
  • 2021-01-04 10:47

    As PyQt is not using setup.py it cannot be installed using pip or easy_install

    Here you have a tutorial showing how to build and install PyQt for python2.7:

    http://problemssol.blogspot.com/2010/12/compile-and-install-pyqt4-for-python27.html

    Update: For Ubuntu 12.04+ just use apt-get:

    apt-get install python-qt4
    
    0 讨论(0)
  • 2021-01-04 10:51

    Please install SIP module first,this is python and c/c++ lib tools, and PyQt4 lib

    0 讨论(0)
  • 2021-01-04 10:56

    You can download any version of PyQt4 here for any version of Python but since you asked for python 2.7, Here is the link for the download for python 2.7:

    https://sourceforge.net/projects/pyqt/files/PyQt4/PyQt-4.11.4/

    0 讨论(0)
  • 2021-01-04 10:59

    You should install PyQt4 in the Python 2.7 environment. To do this run

    easy_install2.7 PyQt4
    

    If easy_install is not installed you will need to first download and install it by running

    python2.7 setup.py install
    
    0 讨论(0)
提交回复
热议问题