How to install pyqt5

How to install pyqt5

Install pyqt

PyQt is often not installed by default. The PyQt module can be used to create desktop applications with Python. In this article you’ll learn how to install the PyQt module.

Desktop applications made with PyQt are cross platform, they will work on Microsoft Windows, Apple Mac OS X and Linux computers (including Raspberry Pi).

How to install PyQt5 on Windows?

To install PyQt on Windows there are a few steps you need to take.
First use the installer from the qt-project website, from qt to install PyQt.

Next you want to install a Python version 3.3 or newer. Check the box to add all of the PyQt5 extras. It’s not necessary to compile everything from source, you can install all the required packages with the installer.

On Python >= 3.6, you can also try this command:

It should work without problems.

How to install PyQt5 on Mac OS X?

On Apple Mac OS X installation is a bit simpler. The first step to take is to install the Mac OS X binary. This installs the PyQt GUI library.

But to use it from Python, you also need Python module. This is where the tool brew comes in.
You can use brew to install pyqt (in the terminal):

How to install PyQt5 on Linux?

Python is often installed by default on Linux (in nearly all of the distributions including Ubuntu). But you want to make sure to use Python 3, because of all the features and ease of use. You can verify that you have the newest Python version with the command:

Once you have Python ready, the next step is to install PyQt.

This isn’t hard to do if you have some Linux experience. You can install PyQt your software package manager. Which package manager to use depends on which Linux distribution you are using.

On Ubuntu Linux / Debian Linux you can use the command:

Configuring to run from terminal

OR

Write the following in /usr/lib/x86_64-linux-gnu/qt-default/qtchooser/default.conf

Create uic.py file.

Create a symlink:

$ sudo ln uic.py «/usr/lib/x86_64-linux-gnu/qt5/bin/uic»

umbe1987 commented Aug 9, 2018

This helped me a lot setting the right qtdesigner! Thanks for sharing this gist! Kind regards, Umberto

ravi97garg commented Sep 4, 2018

Unable to launch /usr/lib/qt5/bin/uic.
How to install pyqt5. Смотреть фото How to install pyqt5. Смотреть картинку How to install pyqt5. Картинка про How to install pyqt5. Фото How to install pyqt5

ChrisVilches commented Sep 16, 2018

ujjwal96 commented Oct 2, 2018

@ravi97garg here write
sudo ln uic.py «/usr/lib/qt5/bin/uic»

mraehanakbar commented Mar 1, 2019

CyberSinister commented May 8, 2019

How do I add PyQt5 to Qt Creator? I’m lost. I’ve spent 4 hours on this and now I’ve given up. Any help?

FangliangBai commented Jun 3, 2019

How do I add PyQt5 to Qt Creator? I’m lost. I’ve spent 4 hours on this and now I’ve given up. Any help?

MrFlava commented Jul 18, 2019

Help me! How to fix this problem?
How to install pyqt5. Смотреть фото How to install pyqt5. Смотреть картинку How to install pyqt5. Картинка про How to install pyqt5. Фото How to install pyqt5

madhuniha commented Jul 18, 2019

ujjwal96 commented Jul 18, 2019

@MrFlava Looks like you either you don’t have python3 in /usr/bin or there’s some error in your uic.py file

ujjwal96 commented Jul 18, 2019

MrFlava commented Jul 18, 2019

@ujjwal96 you mean this?
How to install pyqt5. Смотреть фото How to install pyqt5. Смотреть картинку How to install pyqt5. Картинка про How to install pyqt5. Фото How to install pyqt5

Sokom141 commented Sep 26, 2019

Thank you so much! This worked, as opposed to other methods.

AhsanGhaffar370 commented Dec 8, 2019

aanastasiou commented Jan 8, 2020

So, from the point of view of running python within a virtual environment, it is very likely that all steps to get pyqt5 will work, except the bit that used to bring qt-designer in. If the system has Qt5 installed, it seems to have all the libraries required for it installed too and even if you don’t have pyqt5 installed on the base system, the qtchooser way of launching qtdesigner from above will work.

Therefore, a key component here is qtchooser.

The compiler will become available immediately within the virtualenv once you install pyqt5 there.

It would be great if the settings to launch the designer (in terms of setting up environment variables) where applied by one of the pip packages :/

mohamadjalali commented Jan 17, 2020 •

carlos-antonio-dias commented Feb 5, 2020

And none of it helped. Any ideas?

sahilparekh commented Feb 16, 2020

And none of it helped. Any ideas?

wrishel commented Feb 26, 2020

Top-notch tutorial in that it works without a lot of knowledge about Ubuntu! I think it’s possible that the Desktop Entry section is no longer needed. If you decide to keep it, it needs a minor update.

Learn Python PyQt

pyqt, python, gui

How to install PyQt5 in PyCharm

PyQt5 is a toolkit for creating Python GUI applications. As a cross-platform toolkit, PyQt can run on all major operating systems (Unix, Windows (Mac).

This article describes how to install Python + PyCharm + PyQt5.

With PyQt5, the GUI is designed in two ways:

Install Python + PyCharm + PyQt5.

Step 1. Install Python.

Visit the official website at https://www.python.org/ to download and install your target Python version.

Install PyQt5

Enter the cmd interface. Run the command and wait a moment.

The command is executed and PyQt5 is installed.

Test if pqyt5 is actually installed

Create a new file, example.py, and enter the following code.

After running, the following screen will pop up, indicating that PyQt is working normally.

How to install pyqt5. Смотреть фото How to install pyqt5. Смотреть картинку How to install pyqt5. Картинка про How to install pyqt5. Фото How to install pyqt5

3. Install PyCharm.

Visit the official website http://www.jetbrains.com/pycharm/
Choose download and install Community version.

PyCharm Basic Configuration.

Step 1 Create a new project

Step 2 Set the default PyCharm parser.

Select File | Settings | Project: first | Project Interpreter, set Project Interpreter to The version of python you are using

How to install pyqt5. Смотреть фото How to install pyqt5. Смотреть картинку How to install pyqt5. Картинка про How to install pyqt5. Фото How to install pyqt5

Step 3 Adding third-party libraries

Stay in the Project Interpreter interface, click on the +, find and install pyqt5. pyqt5-sip, pyqt5-tools. After successful installation, the interface should look like this.

How to install pyqt5. Смотреть фото How to install pyqt5. Смотреть картинку How to install pyqt5. Картинка про How to install pyqt5. Фото How to install pyqt5

Step 4 Configuring QtDesigner

Install designer
You can start designer directly from PyCharm. Make sure designer is installed first. Designer is not installed with the pip installation.

On Fedora Linux you can do this:

Ubuntu Linux users can do thiS:

You can also do this:

Once qt5-designer is installed, you can configure it in PyCharm.

PyCharm select File | Settings | Tools | PyCharm. External Tools, click + New Tools, Create QTdesigner and PyUIC tools

How to install pyqt5. Смотреть фото How to install pyqt5. Смотреть картинку How to install pyqt5. Картинка про How to install pyqt5. Фото How to install pyqt5

Configure two key parameters.

Fedora Linux users can link designer-qt5

Ubuntu users can set it to /usr/lib/x86_64-linux-gnu/qt5/bin/designer

Step 5: Configure PyUIC

How to install pyqt5. Смотреть фото How to install pyqt5. Смотреть картинку How to install pyqt5. Картинка про How to install pyqt5. Фото How to install pyqt5

Configure three key parameters.

Test PyQt installation

From code

Now that everything is setup, it’s time to test if everything is setup correctly.
Create a GUI interface using the code below (or any PyQt code).

Select Run->Run first. You should see a PyQt window popup.

QTDesigner

How to install pyqt5. Смотреть фото How to install pyqt5. Смотреть картинку How to install pyqt5. Картинка про How to install pyqt5. Фото How to install pyqt5

In the QT Designer interface, a GUI creation interface will pop up for the first time, click on create to automatically generate a GUI interface.

How to install pyqt5. Смотреть фото How to install pyqt5. Смотреть картинку How to install pyqt5. Картинка про How to install pyqt5. Фото How to install pyqt5

Save the interface as Untitled.ui file.

How to install pyqt5. Смотреть фото How to install pyqt5. Смотреть картинку How to install pyqt5. Картинка про How to install pyqt5. Фото How to install pyqt5

qtswdev/PyQt-How-to-install-pyQt5-on-Windows-10

Use Git or checkout with SVN using the web URL.

Work fast with our official CLI. Learn more.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

How to install pyQt5 on Windows 10 How to install pyQt5 on Windows 10

Download and install latest python exe from https://www.python.org/downloads/

Update pip version if any update available using below command

Download pyQt5 whl(wheel) file from https://pypi.org/project/PyQt5 Install whl(wheel) file using below command

C:\Users \AppData\Local\Programs\Python\Python38-32\Scripts>pip.exe install D:\Softwares\PyQt5-5.14.1-5.14.0-cp35.cp36.cp37.cp38-none-win_amd64.whl

Python is an interpreted, high-level, general-purpose programming language. Created by Guido van Rossum and first released in 1991, Python’s design philosophy emphasizes code readability with its notable use of significant whitespace. Its language constructs and object-oriented approach aim to help programmers write clear, logical code for small and large-scale projects.

Python is dynamically typed and garbage-collected. It supports multiple programming paradigms, including procedural, object-oriented, and functional programming. Python is often described as a «batteries included» language due to its comprehensive standard library.

Python was conceived in the late 1980s as a successor to the ABC language. Python 2.0, released in 2000, introduced features like list comprehensions and a garbage collection system capable of collecting reference cycles. Python 3.0, released in 2008, was a major revision of the language that is not completely backward-compatible, and much Python 2 code does not run unmodified on Python 3.

The Python 2 language, i.e. Python 2.7.x, was officially discontinued on January 1, 2020 (first planned for 2015) after which security patches and other improvements will not be released for it. With Python 2’s end-of-life, only Python 3.5.x[32] and later are supported.

Python interpreters are available for many operating systems. A global community of programmers develops and maintains CPython, an open source reference implementation. A non-profit organization, the Python Software Foundation, manages and directs resources for Python and CPython development

pip (package manager):

pip is a de facto standard package-management system used to install and manage software packages written in Python. Many packages can be found in the default source for packages and their dependencies — Python Package Index (PyPI).

Most distributions of Python come with pip preinstalled. Python 2.7.9 and later (on the python2 series), and Python 3.4 and later include pip (pip3 for Python 3) by default.

pip is a recursive acronym for «Pip Installs Packages».

An output of pip install virtualenv One major advantage of pip is the ease of its command-line interface, which makes installing Python software packages as easy as issuing a command:

pip install some-package-name

Users can also easily remove the package:

pip uninstall some-package-name

Most importantly pip has a feature to manage full lists of packages and corresponding version numbers, possible through a «requirements» file.[5] This permits the efficient re-creation of an entire group of packages in a separate environment (e.g. another computer) or virtual environment. This can be achieved with a properly formatted file and the following command[8], where requirements.txt is the name of the file:

pip$ install some-package-name

PyQt is a Python binding of the cross-platform GUI toolkit Qt, implemented as a Python plug-in. PyQt is free software developed by the British firm Riverbank Computing. It is available under similar terms to Qt versions older than 4.5; this means a variety of licenses including GNU General Public License (GPL) and commercial license, but not the GNU Lesser General Public License (LGPL). PyQt supports Microsoft Windows as well as various flavours of UNIX, including Linux and MacOS (or Darwin).

PyQt implements around 440 classes and over 6,000 functions and methods including:

a substantial set of GUI widgets classes for accessing SQL databases (ODBC, MySQL, PostgreSQL, Oracle, SQLite) QScintilla, Scintilla-based rich text editor widget data aware widgets that are automatically populated from a database an XML parser SVG support classes for embedding ActiveX controls on Windows (only in commercial version) To automatically generate these bindings, Phil Thompson developed the tool SIP, which is also used in other projects.

In August 2009, Nokia, the then owners of the Qt toolkit, released PySide, providing similar functionality, but under the LGPL, after failing to reach an agreement with Riverbank Computing to change its licensing terms to include LGPL as an alternative license.

One of the features of Python that makes it so powerful is the ability to take existing libraries, written in C or C++, and make them available as Python extension modules. Such extension modules are often called bindings for the library.

SIP is a collection of tools that makes it very easy to create Python bindings for C and C++ libraries. It was originally developed in 1998 to create PyQt, the Python bindings for the Qt toolkit, but can be used to create bindings for any C or C++ library. For example it is also used to generate wxPython, the Python bindings for wxWidgets.

SIP comprises a set of build tools and a sip module. The build tools process a set of specification files and generates C or C++ code which is then compiled to create the bindings extension module. Several extension modules may be installed in the same Python package. Extension modules can be built so that they are are independent of the version of Python being used. In other words a wheel created from them can be installed with any version of Python starting with v3.5.

The specification files contain a description of the interface of the C or C++ library, i.e. the classes, methods, functions and variables. The format of a specification file is almost identical to a C or C++ header file, so much so that the easiest way of creating a specification file is to edit a copy of the corresponding header file.

The sip module provides support functions to the automatically generated code. The sip module is installed as part of the same Python package as the generated extension modules. Unlike the extension modules the sip module is specific to a particular version of Python (e.g. v3.5, v3.6, v3.7, v3.8).

SIP makes it easy to exploit existing C or C++ libraries in a productive interpretive programming environment. SIP also makes it easy to take a Python application (maybe a prototype) and selectively implement parts of the application (maybe for performance reasons) in C or C++.

How to install PyQt5 on Windows?

When I try installing the PyQt5 on Windows using the command

I get this error:

I got the pyQt5 from PyQt5 Download.

How can I install PyQt5?

Update:

I installed Qt 5.0.2 for Windows 64-bit (VS 2012, 500 MB) from the Qt Download page and now I have this error:

I added C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin (contains nmake.exe ) to PATH and I got this error:

22 Answers 22

Trending sort

Trending sort is based off of the default sorting method — by highest score — but it boosts votes that have happened recently, helping to surface more up-to-date answers.

It falls back to sorting by highest score if no posts are trending.

Switch to Trending sort

Mainly I use the following command under the cmd

And it works with no problem!

The easiest way to install PyQt is to just use the installer (Link in your answer, step #5). If you install python 3.3, the installer will add all of the PyQt5 extras to that python installation automatically. You won’t need to do any compiling (none of: nmake, nmake install, python configure).

All of the build options are available for if you need a custom install (for instance, using a different version of python, where there isn’t an installer provided by riverbank computing).

If you do need to compile your own version of PyQt5, the steps (as you have found) are here, but assume you have python and a compiler installed and in your path. The installed and in your path have been where you have been running into trouble it seems. I’d recommend using the installer version, but you need to install python 3.3 first.

First try this in your Windows cmd window:

If that is successful, it will look something like this:

If that did not work, you might try this link from SourceForge.

How to find the installer that’s right for you?

To test a successful install, in your Python interpreter, try to import:

Источники информации:

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *