After creating a virtual environment for Python on my mac and installing PyQt6, when I type: from Pyqt6.QtWidgets import QApplication, QWidget, QPushButton, QVboxLayout in IDLE it works with no error but when I try to do so from VSCode, I get the error ModuleNotFoundError: No module named 'PyQt6'. The respective sys.paths from IDLE is:
['', '/Users/awegele/Documents', '/Library/Frameworks/Python.framework/Versions/3.12/lib/python312.zip', '/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12', '/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/lib-dynload', '/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages']
while in VSCode it is:
['/Users/awegele/Documents/Personal Python/Personal', '/Library/Frameworks/Python.framework/Versions/3.12/lib/python312.zip', '/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12', '/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/lib-dynload', '/Users/awegele/Documents/Personal Python/.venv/lib/python3.12/site-packages']
While I was very familiar with Path statements in Windows, I have never really become comfortable with paths on the Mac which is perhaps part of my problem. Please help
I expected it to work in IDLE and VSCode
You most likely need to enable the virtual environment in VS code by clicking on the following button and selecting the venv you just created.