Install Pyqt4 Windows
Posted By admin On 21.09.19Here are Windows wheel packages built by Chris Golke - In the filenames cp27 means C-python version 2.7, cp35 means python 3.5, etc. Since Qt is a more complicated system with a compiled C codebase underlying the python interface it provides you, it can be more complex to build than just a pure python code package, which means it can be hard to install it from source. Make sure you grab the correct Windows wheel file (python version, 32/64 bit), and then use to install it - e.g: C: path where wheel is pip install PyQt4-4.11.4-cp35-none-winamd64.whl Should properly install if you are running an x64 build of Python 3.5. If you install PyQt4 on Windows, files wind up here by default: C: Python27 Lib site-packages PyQt4.
Installation of PyQt on Windows is straight-forward. Visit Riverbank Computing and download the appropriate installer file for your version of Python and Windows: Get the correct binary package for your combination of Python and Windows. Run the installer. PyQt4 Download. If you have purchased a commercial PyQt license then please login to your account using the details sent to you at the time of purchase.
but it also leaves a file here: C: Python27 Lib site-packages sip.pyd If you copy the both the sip.pyd and PyQt4 folder into your virtualenv things will work fine. For example: mkdir c: code cd c: code virtualenv BACKUP cd c: code BACKUP scripts activate Then with windows explorer copy from C: Python27 Lib site-packages the file (sip.pyd) and folder (PyQt4) mentioned above to C: code BACKUP Lib site-packages Then back at CLI: cd. (c: code BACKUP) python backup.py The problem with trying to launch a script which calls PyQt4 from within virtualenv is that the virtualenv does not have PyQt4 installed and it doesn't know how to reference the default installation described above.
But follow these steps to copy PyQt4 into your virtualenv and things should work great.
This is a simple guide on installing the latest (currently 5.6) and on Mac OS X 10.11 (El Capitan) and Linux with Python 3.4, inside a virtual environment. Installation Steps. Python 3. Xcode and command-line tools. Qt libraries. Virtual environment. SIP Python package.
PyQt5 Python package Python 3 First of all, make sure that Python 3 is available on your system. You can easily check this by opening the terminal and entering the command python3.
If you need to install it, check out the, or install it with ( brew install python3) on OS X or your favorite Linux package manager. Install Xcode and command-line tools If you are using OS X, and install it. Then by entering the following command in the terminal: xcode-select -install. This adds a number of tools to your system, such as make, git, gcc, c and g. Install Qt Libraries First we need to download and install the Qt libraries:. Iβd recommend to install Qt into the directory /opt/qt. # Create the directory $ mkdir -p /.venv # Create the virtual environment $ python3 -m venv /.venv/qtproject # Activate the virtual environment $.
/.venv/qtproject/bin/activate At this point, typing the command which python3 should output something like /.venv/qtproject/bin/python3. Install SIP PyQt requires to have the SIP module installed. SIP is a tool for automatically generating Python bindings for C and C libraries. You can either download the.tar.gz file, or install the latest from the source repository with mercurial ( hg). # Extract the tar.gz file $ tar -xvf PyQt-gpl-5.5.1.tar.gz # Change into the PyQt source directory $ cd PyQt-gpl-5.5.1 # Generate the build configuration (make sure to reference 'qmake' from the Qt libs installation directory) $ python3 configure.py -destdir /.venv/qtproject/lib/python3.4/site-packages -qmake /opt/qt/5.6/clang64/bin/qmake # Make and install $ make # this takes a really long time $ sudo make install $ sudo make clean All Done! At this point, everything is successfully installed!
Now letβs check if everything works by importing PyQt5 from Python 3.4. From PyQt5.QtWidgets import QApplication, QWidget, QLabel if name 'main': app = QApplication # Build the window widget w = QWidget w. SetGeometry ( 300, 300, 250, 150 ) # x, y, w, h w. SetWindowTitle ( 'My First Qt App' ) # Add a label with tooltip label = QLabel ( 'Hello World π', w ) label.
Windows Install Sip Pyqt4
SetToolTip ( 'This is a QLabel widget with Tooltip' ) label. Resize ( label. SizeHint ) label.
Install Pyqt4 Mac
Move ( 80, 50 ) # Show window and run w. Exec Save this program as helloqt.py and execute it with python3 helloqt.py (or, if the virtualenv is not activated, with /.venv/qtproject/bin/python3 helloqt.py), and be greeted with this: π Congratulations π Now have fun with some GUI programming! Here are a few useful next steps:. If you have suggestions or feedback, let me know via Update 2016-03-25: python3 -m venv instead of virtualenv.