Как установить PyQt5 для Python 3.6 (windows)?
Мне нужно было установить PyQt5. У меня Python версии 3.6.1. Я прописал в командой строке «pip install pyqt5», через минуту вывело что pyqt5 успешно установлен. Я создал питон файл и написал код, который создает простое окошко. Запускаю. А оно мне —
«This application failed to start because it could not find or load the Qt platform plugin «windows» in «».
Reinstalling the application may fix this problem.»
Я и переустанавливал pyqt (через pip uninstall pyqt5), переустанавливал питон, эта ошибка все равно выбивается.
Что делать. Помогите пожалуйста.
Простой 6 комментариев
Alex Setup:
Потом эта.
Вот код.
Всем глубокоуважаемый привет. Сам долго мучился с этим вопросом.
С начало
pip3 install pyqt5
потом
pip install PyQt5-tools
ищешь в C:\Python36\Lib\site-packages\pyqt5-tools ярлык designer.exe
Рисуешь окна и кнопки в designer.
Сохраняешь в С:\ test.ui и командой С:/test.ui -o С:/test.py конвертируешь питон
или батник сделать.
PS
в pycharm можно настроить открытие designer.exe
x67,
первая инструкция результата не дает.
вторая инструкция.
Установка SIP. Ссылка на инструкцию с установкой SIP битая. Использую pip3 install SIP
Далее качаю PyQt5_gpl-5.9.2.zip и содержимое папки в архиве помещаю в C:\Python 36
Далее запускаю C:\Python 36>python configure.py и выдает ошибку
Error: Use the —qmake argument to explicitly specify a working Qt qmake.
В параграфе выше сообщается что Вы должны убедиться, что переменные среды установлены правильно для вашей среды разработки.. В правильности каких каких переменных сред я должен убедиться? . если причина ошибки в этом.
kapit, с переменными средами рано или поздно сталкивается любой разработчик. Что это, зачем и как их настраивать, читаем в интернете для своей ос. Сип находится через гугл. Тут главное не спешить и разбираться с каждым действием
Pyqt для python 3 6
The pip show pyqt6 command will either state that the package is not installed or show a bunch of information about the package, including the location where the package is installed.
# Install PyQt6 on macOS or Linux
To install PyQt6 on macOS or Linux:
Copied!pip install pyqt6 # 👇️ for Python 3 pip3 install pyqt6 # 👇️ if you get permissions error sudo pip3 install pyqt6 # 👇️ if you don't have pip in your PATH environment variable python -m pip install pyqt6 # 👇️ for python 3 python3 -m pip install pyqt6 # 👇️ alternative if you get permissions error pip install pyqt6 --user
If you get an error that pip isn’t found, use the python -m command.
Copied!python -m pip install pyqt6 python3 -m pip install pyqt6
If you get a permissions error, prefix the command with sudo .
Copied!sudo pip install pyqt6 sudo pip3 install pyqt6
Alternatively, you can install the pyqt6 package in a virtual environment:
Copied!# 👇️ could also be "python -m venv venv" python3 -m venv venv # 👇️ activate virtual env on macOS or Linux source venv/bin/activate # 👇️ install pyqt6 in virtual environment pip install pyqt6
Your virtual environment will use the version of Python that was used to create it.
You can use the pip show command to verify pyqt6 has been installed successfully.
Copied!pip show pyqt6 pip3 show pyqt6 python -m pip show pyqt6 python3 -m pip show pyqt6
The pip show pyqt6 command will either state that the package is not installed or show a bunch of information about the package.
# Install PyQt6 in Visual Studio Code
To install PyQt6 in Visual Studio Code:
- Press CTRL + ` (Backtick) on your keyboard to open the terminal.
- Run the pip install pyqt6 command to install the PyQt6 module.
Copied!pip install pyqt6 # 👇️ for Python 3 pip3 install pyqt6 # 👇️ if you get permissions error sudo pip3 install pyqt6 # 👇️ if you don't have pip in your PATH environment variable python -m pip install pyqt6 # 👇️ for python 3 python3 -m pip install pyqt6 # 👇️ using py alias py -m pip install pyqt6 # 👇️ alternative if you get permissions error pip install pyqt6 --user
You can also open the terminal in Visual studio code by pressing CTRL+Shift+P and then typing «View: Toggle Terminal».
Press CTRL+Shift+P or ( ⌘ + Shift + P on Mac) to open the command palette.
Then type «Python select interpreter» in the field.
Then select the correct Python version from the dropdown menu.
Your IDE should be using the same version of Python (including the virtual environment) that you are using to install packages from your terminal.
You can use the python —version command if you need to get your version of Python.
Copied!python --version python3 --version
You can also try creating a virtual environment if you don’t already have one.
Copied!# 👇️ could also be "python -m venv venv" or "py -m venv venv" python3 -m venv venv # 👇️ activate on Unix or MacOS source venv/bin/activate # 👇️ activate on Windows (cmd.exe) venv\Scripts\activate.bat # 👇️ activate on Windows (PowerShell) venv\Scripts\Activate.ps1 # 👇️ install pyqt6 in virtual environment pip install pyqt6
Your virtual environment will use the version of Python that was used to create it.
# Install PyQt6 in PyCharm
To install PyQt6 in PyCharm:
- Press Alt+F12 on your keyboard to open the terminal.
- Run the pip install pyqt6 command to install the PyQt6 module.
Copied!pip install pyqt6 # 👇️ for Python 3 pip3 install pyqt6 # 👇️ if you get permissions error sudo pip3 install pyqt6 # 👇️ if you don't have pip in your PATH environment variable python -m pip install pyqt6 # 👇️ for python 3 python3 -m pip install pyqt6 # 👇️ using py alias py -m pip install pyqt6 # 👇️ alternative if you get permissions error pip install pyqt6 --user
Alternatively, you can use the IDE itself to install the module.
- Click on «File» > «Settings» > «Project» > «Python Interpreter».
- Click on the + icon and type PyQt6 .
- Click on «Install Package».
When installing Python modules in PyCharm, make sure that your IDE is configured to use the correct version of Python.
Click on «File» > «Settings» > «Project» > «Python Interpreter».
Then select the correct Python version from the dropdown menu.
Your IDE should be using the same version of Python (including the virtual environment) that you are using to install packages from your terminal.
You can use the python —version command if you need to get your version of Python.
Copied!python --version python3 --version
# Install PyQt6 in Anaconda
If you are on Windows, search for «Anaconda Prompt» and open the application.
If you are on macOS or Linux, open your terminal.
Run the following command to install the pyqt6 package.
Copied!# 👇️ Alternatively use `pip` pip install pyqt6 # 👇️ for Python 3 pip3 install pyqt6 # 👇️ if you get permissions error sudo pip3 install pyqt6 # 👇️ if you don't have pip in your PATH environment variable python -m pip install pyqt6 # 👇️ for python 3 python3 -m pip install pyqt6 # 👇️ using py alias py -m pip install pyqt6 # 👇️ alternative if you get permissions error pip install pyqt6 --user
# Install PyQt6 in Jupyter Notebook
To install PyQt6 in Jupyter Notebook:
Copied!# 👇️ using pip pip install pyqt6 # 👇️ for Python 3 pip3 install pyqt6 # 👇️ if you get permissions error sudo pip3 install pyqt6 # 👇️ if you don't have pip in your PATH environment variable python -m pip install pyqt6 # 👇️ for python 3 python3 -m pip install pyqt6 # 👇️ using py alias py -m pip install pyqt6 # 👇️ alternative if you get permissions error pip install pyqt6 --user
Alternatively, you can use the Python ipykernel.
- Click on «New» and then click on «Python 3 (ipykernel)».
- Type !pip install pyqt6 and click on «Run».
Note that the pip install command must be prefixed with an exclamation mark if you use this approach.
Once you type the command, click «Run» to install the pyqt6 module.
If you get a permissions error, e.g. » [WinError: 5] Access is denied», add the —user option to the installation command.
Copied!!pip install pyqt6 --user
I wrote a book in which I share everything I know about how to become a better, more efficient programmer.