Unable to import PySide2
-
Hello everyone,
I am new to the QT Creator on Mac and when I first started to run a simple standard widget I got the "ImportError" as you can see in the screenshot. I checked my installation of PySide2 with "pip install PySide2" but it seems to be installed. Can anyone give me a hint on how to solve the problem? Thanks in advance!
PeterOutput:
Traceback (most recent call last): File "/Users/XYZ/DropSizeGetter_NEW/dropsizegetter.py", line 3, in <module> from PySide2.QtWidgets import QApplication, QWidget ImportError: No module named PySide2.QtWidgets
-
-
@Pit96
For bothpip
&pip3
you can gopip[3] list
to list what actually is installed. I would look through that, carefully, If what it is complaining about is indeed installed, then I can only guess that where you are trying to run your code from is not using where you pip installed to, e.g. inside/outside a virtual environment? I am unsure whether messageImportError: No module named PySide2.QtWidgets
is telling youPySide2
found but noQtWidgets
there, or whether it means noPySide2
at all, you might play with that. -
@JonB So I followed your suggestion and also copied the code to PyCharm. When I did that it still said that it cannot find PySide2 but it asked me if I want to install it. After I did it the code worked in PyCharm. I also checked if PySide2 is installed for both Python Versions and it is. So I guess it is really a problem regarding a virtual environment. My question is now how do I know if my QT Creator App is working inside/outside a virtual environment? Thanks in Advance!
-
This post is deleted!
-
Old topic but same problem but it solved for me like this:
pip3 list and pip list both showed PySide2 as installed. In Qt/Options I noticed Python 2.7 as default. Changed this to 3.6 and then when trying to compile I was asked to install some more stuff. After that everything worked.
-
@dalilander Hi there, hey I'm having the same problem. What do you mean by Qt/Options - where do I find these options to change this to 3.7 (for me).
I'm working with 3.7.3 on a Windown 10 machine. Anaconda Navagator to manage packages. I'm quite new to all of this so any information would be great.