Search code examples
pythonpython-3.xpycharmpython-idlepython-venv

Python Program won't run in IDLE but runs in terminal


I wrote a program in Python (PyCharm IDE) and have a VENV. When I run it in the terminal after activating the venv or in PyCharm (still a terminal) it works perfectly as expected. I have a few third party libraries that I use like panda and I believe xlsx. When I try to run main.py from IDLE (by loading up that file) it just lets me know that it can't find import pandas. Is there anyway to run this program I wrote on IDLE? Supposedly that's a requirement of the task. I'm using Python3 I believe. IDLE is v3.8 I believe.

I have a main.py and 2 .py files that I have implemented. Then another file (Excel Sheet) that I import data from and manipulate.

Any help would be greatly appreciated!

I didn't post a code sample cause I don't see how it would be useful in this situation but please let me know if it's needed!


Solution

  • You can start the venv from the terminal and then run:

    python -m idlelib.idle
    

    On macOS brew install python-tk will install tk which will allow idle to open.