I have Python 3.8.1 installed and I've followed PyGObject tutorial to install the module.
I've installed MSYS2 64 bits and I certainly can import the gi module using MSYS2 terminal:
However, if I run Python from the cmd prompt or from PyCharm, it won't work:
I want to be able to run my project from PyCharm. What am I missing?
Look at the first lines that both Pythons produce. They are different.
The command-line python is a 64-bit version compiled with GCC.
The Python inside pycharm is a 32-bit version compiled with MSC.
Bottom line: Pycharm is not using the Python that you installed PyGObject in.
Edit
If you're not using the second Python instance, and nothing else on your system is using it, then it is indeed useless.
Having said that, 32-bit programs on windows have a limited adress space (2.5 GiB, IIRC). For data-science projects that might be a significant limitation these days. So I would stick to 64-bit programs these days, unless your PC has less than 4 GiB of RAM. Then it makes sense to run 32-bit software.
Another point is that I've seen reports here on Stackoverflow that Pycharm can interact negatively with Python programs that run inside it. Especially if you are running multiprocessing
. So you should always test your code from a standalone Python, not from within Pycharm.