'ModuleNotFoundError: No module named 'PySide6' in Python using Visual Studio Code
*** Update *** This issue was solved by whiteroom in the comments section. The issue was that the Python Interpreter setting needed to be changed to point to the correct one. The whiteroom question answer was also very helpful.
*** Original Question *** I installed PySide6 on my MacBook and confirmed that it is installed as shown in the attached screen shot. I'm also very new to Python and using the Mac Terminal app.
pip3 install PySide6
I tried to run this simple app from the Visual Studio Code editor.
from PySide6.QtWidgets import QApplication,QLabel
app = QApplication([])
label = QLabel('hello world')
label.show()
app.exec()
Python responded with this error:
Traceback (most recent call last):
File "/Users/emad-ud-deen/Development/Python/Practice/PySide6 Test.py", line 1, in <module>
from PySide6.QtWidgets import QApplication,QLabel
ModuleNotFoundError: No module named 'PySide6'
The only way I'm able to run the apps I write with PySide6 without that error is from the command line in Terminal.
Can you tell me how to get Visual Studio Code to recognise PySide6?
Solution 1:[1]
I have the same question with you, but I've just found a solution:
You can use command like this:
pip uninstall pyside6-addons
pip uninstall pyside6-essentials
pip uninstall pyside6
pip install pyside6-essentials
Actually, if you don't want to use so difficult plugins, just install PySide6-Essentials[1] is benefit for you :)
References:
[1] https://www.qt.io/blog/qt-for-python-details-on-the-new-6.3-release
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | whitroom |

