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.7k18 gold badges83 silver badges104 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,87823 silver badges23 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

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

There’s definitely some Bad Stuff™️ going on when installing.. looks like some packages are missing.

dialogcancel(0)
Loop Setting unchanged.
RTL Webinterface Setting unchanged.
BTC-RPC-Explorer Setting unchanged.
Cryptoadvance Specter Setting unchanged.
ElectRS Setting unchanged.
BTCPayServer setting not changed.
lndmanage setting unchanged.
faraday setting unchanged.
Balance of Satoshis setting unchanged.
PyBLOCK setting unchanged.
ThunderHub setting unchanged.
LNbits setting unchanged.
JoinMarket setting changed ..
*** INSTALL JOINMARKET ***
# OK, running behind Tor
Multiwallet is active and wallet.dat is used.
The bitcoin core wallet is already on
# cleaning before install
# add the 'joinmarket' user
Adding user `joinmarket' ...
Adding new group `joinmarket' (1008) ...
Adding new user `joinmarket' (1008) with group `joinmarket' ...
Creating home directory `/home/joinmarket' ...
Copying files from `/etc/skel' ...
# setting PASSWORD_B as the password for the 'joinmarket' user
Adding user `joinmarket' to group `sudo' ...
Adding user joinmarket to group sudo
Done.
joinmarket ALL=(ALL) NOPASSWD:ALL
# specified to use wallet.dat in the recovered joinmarket.cfg
# installing ARM specific dependencies to run the QT GUI
Reading package lists... Done
Building dependency tree       
Reading state information... Done
zlib1g-dev is already the newest version (1:1.2.11.dfsg-1).
zlib1g-dev set to manually installed.
The following package was automatically installed and is no longer required:
  libbluetooth3
Use 'sudo apt autoremove' to remove it.
The following additional packages will be installed:
  libjpeg62-turbo-dev libpyside2-py3-5.11 libqt5designer5 libqt5help5 libqt5qml5 libqt5test5 libshiboken2-py3-5.11 python3-sip
Suggested packages:
  qt5-qmltooling-plugins python3-pyqt5-dbg python-pyside2-doc
The following NEW packages will be installed:
  libjpeg-dev libjpeg62-turbo-dev libpyside2-py3-5.11 libqt5designer5 libqt5help5 libqt5qml5 libqt5test5 libshiboken2-py3-5.11 python3-pyqt5 python3-pyside2.qtcore python3-pyside2.qtgui
  python3-pyside2.qtwidgets python3-sip
0 upgraded, 13 newly installed, 0 to remove and 128 not upgraded.
Need to get 236 kB/8,641 kB of archives.
After this operation, 40.2 MB of additional disk space will be used.
Err:1 http://raspbian.raspberrypi.org/raspbian buster/main armhf libjpeg62-turbo-dev armhf 1:1.5.2-2+b1
  404  Not Found [IP: 93.93.128.193 80]
Err:2 http://raspbian.raspberrypi.org/raspbian buster/main armhf libjpeg-dev all 1:1.5.2-2
  404  Not Found [IP: 93.93.128.193 80]
E: Failed to fetch http://raspbian.raspberrypi.org/raspbian/pool/main/libj/libjpeg-turbo/libjpeg62-turbo-dev_1.5.2-2+b1_armhf.deb  404  Not Found [IP: 93.93.128.193 80]
E: Failed to fetch http://raspbian.raspberrypi.org/raspbian/pool/main/libj/libjpeg-turbo/libjpeg-dev_1.5.2-2_all.deb  404  Not Found [IP: 93.93.128.193 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
# installing JoinMarket
Cloning into 'joinmarket-clientserver'...
remote: Enumerating objects: 195, done.
remote: Counting objects: 100% (195/195), done.
remote: Compressing objects: 100% (124/124), done.
remote: Total 8303 (delta 95), reused 136 (delta 71), pack-reused 8108
Receiving objects: 100% (8303/8303), 6.84 MiB | 5.08 MiB/s, done.
Resolving deltas: 100% (5508/5508), done.
HEAD is now at a087d26 Merge #701: add release notes and update version 0.7.1
Already using interpreter /usr/bin/python3
Using base prefix '/usr'
New python executable in /home/joinmarket/joinmarket-clientserver/jmvenv/bin/python3
Also creating executable in /home/joinmarket/joinmarket-clientserver/jmvenv/bin/python
Installing setuptools, pkg_resources, pip, wheel...done.
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'PySide2'
X11 connection rejected because of wrong authentication.
X11 connection rejected because of wrong authentication.
X11 connection rejected because of wrong authentication.
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: pip in ./jmvenv/lib/python3.7/site-packages (21.0.1)
X11 connection rejected because of wrong authentication.
X11 connection rejected because of wrong authentication.
X11 connection rejected because of wrong authentication.
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: setuptools in ./jmvenv/lib/python3.7/site-packages (53.0.0)
~/joinmarket-clientserver/deps ~/joinmarket-clientserver
~/joinmarket-clientserver/deps/cache ~/joinmarket-clientserver/deps ~/joinmarket-clientserver
sha256sum: 0d9540b13ffcd7cd44cc361b8744b93d88aa76ba.tar.gz: No such file or directory
0d9540b13ffcd7cd44cc361b8744b93d88aa76ba.tar.gz: FAILED open or read
sha256sum: WARNING: 1 listed file could not be read
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   164  100   164    0     0    788      0 --:--:-- --:--:-- --:--:--   792
100  168k    0  168k    0     0   288k      0 --:--:-- --:--:-- --:--:-- 2292k
0d9540b13ffcd7cd44cc361b8744b93d88aa76ba.tar.gz: OK
~/joinmarket-clientserver/deps ~/joinmarket-clientserver
~/joinmarket-clientserver/deps/secp256k1-0d9540b13ffcd7cd44cc361b8744b93d88aa76ba ~/joinmarket-clientserver/deps ~/joinmarket-clientserver
make: *** No rule to make target 'clean'.  Stop.

Понравилась статья? Поделить с друзьями:
  • Nissan tiida ошибка подушки безопасности
  • Nissan tiida ошибка p1611
  • Nissan tiida ошибка p1126
  • Nissan tiida ошибка p1111
  • Nissan tiida ошибка abs