How to install PyQt4 in anaconda?

后端 未结 7 1318
自闭症患者
自闭症患者 2020-11-27 15:15

From the PyQt4 website their instructions for installing the package are to download the tarball and use the config file. I have two versions of Python, one is my normal sys

相关标签:
7条回答
  • 2020-11-27 15:41

    Updated version of @Alaaedeen's answer. You can specify any part of the version of any package you want to install. This may cause other package versions to change. For example, if you don't care about which specific version of PyQt4 you want, do:

    conda install pyqt=4
    

    This would install the latest minor version and release of PyQt 4. You can specify any portion of the version that you want, not just the major number. So, for example

    conda install pyqt=4.11
    

    would install the latest (or last) release of version 4.11.

    Keep in mind that installing a different version of a package may cause the other packages that depend on it to be rolled forward or back to where they support the version you want.

    0 讨论(0)
  • 2020-11-27 15:45

    Successfully installed it on OSX using homebrew:

    brew install sip
    brew install pyqt     
    

    which (currently) installs PyQt4. Anaconda is the main python on the machine (OSX 10.8.5).

    0 讨论(0)
  • 2020-11-27 15:45

    For windows users, there is an easy fix. Download whl files from:

    https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyqt4

    run from anaconda prompt pip install PyQt4‑4.11.4‑cp37‑cp37m‑win_amd64.whl

    0 讨论(0)
  • 2020-11-27 15:59

    Well, here is another way - you could use python to call these commands:

    npm install -g pageres-cli
    

    Then you can simply do this:

    pageres google.com --format=jpg --filename=...
    

    Or if you have wkhtmltoimage installed (sudo apt install wkhtmltopdf), simply do this:

    wkhtmltoimage www....com filename.jpg
    

    So no trouble with any lib or whatever anymore and call these commands from within your python project.

    0 讨论(0)
  • 2020-11-27 16:06

    How to install PyQt4 on anaconda python 2 on Windows:

    At first I have tried to isntall pyqt4 via pip install:

    C:\Users\myuser\Anaconda2\Scripts\pip.exe search pyqt4 > pyqt4.txt

    It shows:

    PyQt4 (4.11.4) - Python bindings for the Qt cross platform GUI toolkit
    

    But when I tried to install, it gives an error:

    C:\Users\myuser\Anaconda2\Scripts\pip.exe install PyQt4
    Collecting PyQt4
      Could not find a version that satisfies the requirement PyQt4 (from versions:
    )
    No matching distribution found for PyQt4
    

    Seems this answer is realated to this problem: https://superuser.com/a/725869/213959

    Then I have tried to install it via conda install ( How to install PyQt4 in anaconda? ) :

    C:\Users\myuser\Anaconda2\Scripts\conda.exe search pyqt
    

    It shows:

    pyqt                         4.10.4                   py26_0  defaults        
                                 4.10.4                   py27_0  defaults        
                                 4.10.4                   py33_0  defaults        
                                 4.10.4                   py34_0  defaults        
                                 4.10.4                   py26_1  defaults        
                                 4.10.4                   py27_1  defaults        
                                 4.10.4                   py33_1  defaults        
                                 4.10.4                   py34_1  defaults        
                                 4.11.4                   py27_0  defaults        
                                 4.11.4                   py35_0  defaults        
                                 4.11.4                   py27_2  defaults        
                                 4.11.4                   py34_2  defaults        
                                 4.11.4                   py35_2  defaults        
                                 4.11.4                   py27_3  defaults        
                                 4.11.4                   py34_3  defaults        
                                 4.11.4                   py35_3  defaults        
                                 4.11.4                   py27_4  defaults        
                                 4.11.4                   py34_4  defaults        
                                 4.11.4                   py35_4  defaults        
                                 4.11.4                   py27_5  defaults        
                                 4.11.4                   py34_5  defaults        
                                 4.11.4                   py35_5  defaults        
                                 4.11.4                   py27_6  defaults        
                                 4.11.4                   py34_6  defaults        
                                 4.11.4                   py35_6  defaults        
                                 4.11.4                   py27_7  defaults        
                                 4.11.4                   py34_7  defaults        
                                 4.11.4                   py35_7  defaults        
                                 5.6.0                    py27_0  defaults        
                                 5.6.0                    py34_0  defaults        
                                 5.6.0                    py35_0  defaults        
                                 5.6.0                    py27_1  defaults        
                                 5.6.0                    py34_1  defaults        
                                 5.6.0                    py35_1  defaults        
                                 5.6.0                    py27_2  defaults        
                                 5.6.0                    py34_2  defaults        
                                 5.6.0                    py35_2  defaults        
                                 5.6.0                    py36_2  defaults        
                                 5.6.0            py27h224ed30_5  defaults        
                                 5.6.0            py35hd46907b_5  defaults        
                                 5.6.0            py36hb5ed885_5  defaults  
    

    But it gives error:

    C:\Users\myuser\Anaconda2\Scripts\conda.exe install pyqt=4.11.4
    Fetching package metadata .............
    Solving package specifications: .
    
    UnsatisfiableError: The following specifications were found to be in conflict:
      - navigator-updater -> pyqt >=5.6 -> qt 5.6.*
      - pyqt 4.11.4* -> qt >=4.8.6,<5.0
      - pyqt 4.11.4* -> sip >=4.16.4,<4.18
    Use "conda info <package>" to see the dependencies for each package.
    

    Same with -c parameter:

    C:\Users\myuser\Anaconda2\Scripts\conda.exe install -c anaconda pyqt=4.11.4
    Fetching package metadata ...............
    Solving package specifications: .
    
    UnsatisfiableError: The following specifications were found to be in conflict:
      - navigator-updater -> pyqt >=5.6 -> qt 5.6.*
      - pyqt 4.11.4* -> qt >=4.8.6,<5.0
      - pyqt 4.11.4* -> sip >=4.16.4,<4.18
    Use "conda info <package>" to see the dependencies for each package.
    

    Then I tried to uninstall pyqt:

    C:\Users\myuser\Anaconda2\Scripts\conda.exe uninstall pyqt
    

    And installed it again:

    C:\Users\myuser\Anaconda2\Scripts\conda.exe install -c anaconda pyqt=4.11.4
    

    And finnaly it works!

    0 讨论(0)
  • 2020-11-27 16:07

    FYI

    PyQt is now available on all platforms via conda!
    Use conda install pyqt to get these #Python bindings for the Qt framework. @ 1:02 PM - 1 May 2014

    https://twitter.com/ContinuumIO/status/461958764451880960

    0 讨论(0)
提交回复
热议问题