No module named pyside2 ошибка

I am trying to run python file on my terminal and I get the error of «no module named pyside2″

I tried the to run the code which was already answered on similar type of question. But no changes on my side.

ERROR message:

Traceback (most recent call last)
File "xxx-qt.py", line 31, in <module>
from pyside2 import qtcore
Modulenotfounderror: NO module named "pyside2"

peterh's user avatar

peterh

11.9k19 gold badges85 silver badges108 bronze badges

asked Jul 15, 2019 at 4:49

Charul's user avatar

3

The problem arises because you haven’t the module in your environment, you can install it using pip install PySide2

For more about PySide2: https://pypi.org/project/PySide2/

pixelgrease's user avatar

answered Jul 15, 2019 at 5:02

muhammed fairoos nm's user avatar

You used all lower-case letters in your PySide2 import statement.

The error message shows that your code imports using lowercase letters instead of mixed case:

NO module named "pyside2"

You probably installed PySide2 using all lowercase letters, pip install pyside2, but your code must import from: PySide2.

answered Aug 6, 2019 at 17:49

pixelgrease's user avatar

pixelgreasepixelgrease

1,94024 silver badges26 bronze badges

1

I solved this issue by:

1. Repairing my Python installation
2. Deleting the virtual environment
3. Creating a new virtual environment
4. Running pip install PySide2 in the new virtual environment

answered Oct 31, 2019 at 22:05

HobbesKo's user avatar

HobbesKoHobbesKo

461 silver badge5 bronze badges

I had the same problem and solved it with the following way.

Reference from Qt for Python & PyInstaller

Since it has a UI, you use the –windowed option.

The command line to proceed looks like this:

pyinstaller --name="MyApplication" --windowed hello.py

This process creates two directories: dist/ and build/. The
application executable and the required shared libraries are placed in
dist/MyApplication.

To run the application, go to dist/MyApplication and run the program:

cd dist/MyApplication/
./MyApplication

answered Jul 26, 2020 at 3:45

IHC's user avatar

Well there might be one of these two problems:

  1. You have not installed PySide2, In that case you can install it using command pip install PySide2
  2. The second is you have installed the Pyside2 but in one installation and trying to use it from another installation, to tackle with this, Create a virtual environment for your project and install all modules in that virtual environment.

It’s always a good idea to create virtual environment for project it will avoid breaking the base env. It avoid such kind of issues

answered May 1, 2021 at 5:12

Harshit Kesharwani's user avatar

I am trying to run python file on my terminal and I get the error of «no module named pyside2″

I tried the to run the code which was already answered on similar type of question. But no changes on my side.

ERROR message:

Traceback (most recent call last)
File "xxx-qt.py", line 31, in <module>
from pyside2 import qtcore
Modulenotfounderror: NO module named "pyside2"

peterh's user avatar

peterh

11.9k19 gold badges85 silver badges108 bronze badges

asked Jul 15, 2019 at 4:49

Charul's user avatar

3

The problem arises because you haven’t the module in your environment, you can install it using pip install PySide2

For more about PySide2: https://pypi.org/project/PySide2/

pixelgrease's user avatar

answered Jul 15, 2019 at 5:02

muhammed fairoos nm's user avatar

You used all lower-case letters in your PySide2 import statement.

The error message shows that your code imports using lowercase letters instead of mixed case:

NO module named "pyside2"

You probably installed PySide2 using all lowercase letters, pip install pyside2, but your code must import from: PySide2.

answered Aug 6, 2019 at 17:49

pixelgrease's user avatar

pixelgreasepixelgrease

1,94024 silver badges26 bronze badges

1

I solved this issue by:

1. Repairing my Python installation
2. Deleting the virtual environment
3. Creating a new virtual environment
4. Running pip install PySide2 in the new virtual environment

answered Oct 31, 2019 at 22:05

HobbesKo's user avatar

HobbesKoHobbesKo

461 silver badge5 bronze badges

I had the same problem and solved it with the following way.

Reference from Qt for Python & PyInstaller

Since it has a UI, you use the –windowed option.

The command line to proceed looks like this:

pyinstaller --name="MyApplication" --windowed hello.py

This process creates two directories: dist/ and build/. The
application executable and the required shared libraries are placed in
dist/MyApplication.

To run the application, go to dist/MyApplication and run the program:

cd dist/MyApplication/
./MyApplication

answered Jul 26, 2020 at 3:45

IHC's user avatar

Well there might be one of these two problems:

  1. You have not installed PySide2, In that case you can install it using command pip install PySide2
  2. The second is you have installed the Pyside2 but in one installation and trying to use it from another installation, to tackle with this, Create a virtual environment for your project and install all modules in that virtual environment.

It’s always a good idea to create virtual environment for project it will avoid breaking the base env. It avoid such kind of issues

answered May 1, 2021 at 5:12

Harshit Kesharwani's user avatar

@BD4L
The Qt Creator I have is 4.8.1, which is based on the Qt 5.12.2 which was released packaged with the Ubuntu 19.04 I use. It still has nothing about Python/PySide2 in it! So if yours has support for PySide2 projects I haven’t seen it! I am «dubious» about how good its Python editing and debugging support will be, but that’s me being cynical, I have no evidence for this :) If you are happy with those features then go ahead, a fully integrated, single environment is nice.

For my part I have used PyCharm with PyQt and VS Code with PySide2. I find PyCharm a much better editing & debugging experience compared to VS Code, which personally I have been disappointed with and don’t much like, but your mileage may vary. They all work fine, though, and are much preferable to a plain text editor and no IDE. In both cases if you want to design the layout in Qt Creator/Designer you have to do that outside of PyCharm/VS Code. As I said, if whatever Creator’s support for Python is you are happy with it then go for it.

Your comments about Creator being a standard-ish IDE, for use with Qt, are quite correct. It has its pros & cons like any IDE. Designer does not produce any code, it just generates a .ui file describing exactly the layout you have made. It is the pyuic program supplied with PySide2/PyQt which generates Python code from the .ui. You do not even have to use it or generate any code if you do not want to, you could load the .ui directly at run-time. Though I would recommend you do use it to generate code, it’s easier to manipulate with the resulting class/code. Qt was always as «meant to be used» via the Designer as with direct, dynamic widget creation. The code pyuic generates is fine, and perfectly intelligible, and corresponds to the C++ code which would be produced from uic.

I have done both non-Designer dynamic creation and static creation via uic generated code. Again, pros & cons to each. Certainly as a beginner to Qt the Designer gives you a good start.

Both PySide2 and PyQt are essentially just Python language bindings to the supplied Qt C++ libraries, offering one-to-one correspondence against the methods exported from Qt. No more and no less.

Я пытаюсь запустить файл Python на моем терминале, и я получаю сообщение об ошибке «нет модуля с именем pyside2″

Я попытался запустить код, на который уже был дан ответ на подобный тип вопроса. но без изменений на моей стороне.

Сообщение об ошибке:

Traceback (последний вызов был последним) Файл «xxx-qt.py», строка 31, из pyside2 import qtcore
Modulenotfounderror: НЕТ модуля с именем «pyside2»

2019-07-15 07:49

5
ответов

Проблема возникает потому, что у вас нет модуля в вашей среде, вы можете установить его с помощью pip install PySide2

Подробнее о PySide2: https://pypi.org/project/PySide2/

2019-07-15 08:02

Вы использовали все строчные буквы в своем PySide2 заявление на импорт.

Сообщение об ошибке показывает, что ваш код импортируется с использованием строчных букв вместо смешанных:

NO module named "pyside2"

Вы, вероятно, установили PySide2, используя все строчные буквы, pip install pyside2, но ваш код должен импортировать из: PySide2,

2019-08-06 20:49

У меня была такая же проблема, и я решил ее следующим образом.

Ссылка из Qt для Python и PyInstaller

Поскольку у него есть пользовательский интерфейс, вы можете использовать параметр –windowed.

Командная строка для продолжения выглядит следующим образом:

pyinstaller --name="MyApplication" --windowed hello.py

Этот процесс создает два каталога: dist/ и build/. Исполняемый файл приложения и необходимые разделяемые библиотеки помещаются в dist/MyApplication.

Чтобы запустить приложение, перейдите в dist / MyApplication и запустите программу:

cd dist/MyApplication/
./MyApplication

2020-07-26 06:45

Я решил эту проблему:

1. Восстановление моей установки Python
2. Удаление виртуальной среды
3. Создание новой виртуальной среды
4. Запускpip install PySide2 в новой виртуальной среде

2019-11-01 01:05

Что ж, может быть одна из этих двух проблем:

  1. Вы не установили PySide2, в этом случае вы можете установить его с помощью команды pip install PySide2
  2. Во-вторых, вы установили Pyside2, но в одной установке и пытаетесь использовать его из другой установки, чтобы решить эту проблему, создайте виртуальную среду для своего проекта и установите все модули в этой виртуальной среде.

Всегда полезно создавать виртуальную среду для проекта, это позволит избежать нарушения базового env. Это позволяет избежать таких проблем

2021-05-01 08:12

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Pick a username
Email Address
Password

By clicking “Sign up for GitHub”, you agree to our terms of service and
privacy statement. We’ll occasionally send you account related emails.

Already on GitHub?
Sign in
to your account

Понравилась статья? Поделить с друзьями:
  • Nod 32 ошибка активации act 0
  • No mans sky ошибка драйвера vulkan
  • No module named config ошибка
  • Nockenwellengeber bmw ошибка бмв
  • No api calls possible inpa ошибка