Guide to install PyQt5 on Mac OS X with python 3.4 virtualenv Description. A simple guide to install PyQt5 on Mac OS X 10.9 (Maverick) and use python 3.4 on a virtualenv. Meanwhile I have the ultimate way to install PyQt5 on macOS. Don't use Homebrew. It is great for installing Qt5, but for PyQt5 the best way to install it is using. Python3 -m pip install PyQt5 This works very quickly and uses universal Python Wheels.
- How To Install Pyqt5 For Mac Os Mojave
- How To Install Pyqt5 Designer
- How To Install Pyqt5 For Mac Os High Sierra
- How To Install Pyqt5 Ubuntu
install.sh
cd~ |
mkdir dev_tools |
cd dev_tools |
## download SIP source code |
wget http://sourceforge.net/projects/pyqt/files/sip/sip-4.16.7/sip-4.16.7.tar.gz |
tar zxf sip-4.16.7.tar.gz |
cd sip-4.16.7 |
python configure.py |
make |
make install |
## environ for pyQT |
export PATH='/System/Library/Frameworks/Python.framework/Versions/2.7/bin:$PATH' |
export PATH='/Users/fu/Qt/5.4/clang_64/bin:$PATH' |
## check for python's package path |
python -c 'import site; print site.getsitepackages()' |
## compile pyQT ... |
python configure.py |
-q /Users/fu/Qt/5.4/clang_64/bin/qmake |
-d /Library/Python/2.7/site-packages/ |
--sip /System/Library/Frameworks/Python.framework/Versions/2.7/bin/sip |
make |
sudo make install |
## test if pyQT is installed |
# test.py |
import sys |
from PyQt5 import QtCore, QtGui, QtWidgets |
if __name__ '__main__': |
app = QtWidgets.QApplication(sys.argv) |
w = QtWidgets.QWidget() |
w.resize(250, 150) |
w.move(300, 300) |
w.setWindowTitle('Simple') |
w.show() |
sys.exit(app.exec_()) |
# Refs: |
# http://www.phodal.com/blog/pyqt5-mac-os-install/ |
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment
Pyqt window style can be configured.
The default style of PyQt is called ‘Fusion’. But this isn’t the only style, there are many styles or themes like ‘QtCurve’, ‘Windows’ and others.
How To Install Pyqt5 For Mac Os Mojave
You may want to distribute your app on multiple operating systems, and have a native look and feel. To do that, you change the theme.
If you are on Windows, you want the Windows look. On Mac you want the Mac OS X style. All of these can be configured. The Mac style is only available on Mac OS X.
Related Course:Create GUI Apps with Python PyQt5
PyQt style
Available styles
The available PyQt styles may differ system to system, but because many people install the PyQt binary the styles installed are often the same. You can get a list of available styles using the Python interpreter, like so:
The Breeze style looks like this:
How To Install Pyqt5 Designer
Configure style
After creating the application with
QApplication([])
, you can can set the Qt style with the function setStyle(style)
. For example if you want to set the style to Fusion, you add the line app.setStyle('Fusion')
.In the example below we set the Windows style like so:
![Install pyqt5 mac Install pyqt5 mac](https://www.phpfans.net/article/images/f3125f24a10d7f3b3067eaf43d5db4fc.png)
How To Install Pyqt5 For Mac Os High Sierra
Then the window shows like this (the old Win 9x style):
How To Install Pyqt5 Ubuntu
If you are new to Python PyQt, then I highly recommend this book.