The IDLE shell window is not the same as a terminal shell (e.g. running sh or bash). Rather, it is just like being in the Python interactive interpreter (python -i). The easiest way to run a script in IDLE is to use the Open command from the File menu (this may vary a bit depending on which platform you are running) to load your script file into an IDLE editor window and then use the Run ...
How to start IDLE (Python editor) without using the shortcut on Windows ...
For running Python 2, all I do is activate the required Conda environment and just type idle. It automatically opens IDLE for Python 2.7. But I can't figure out how to do this for Python 3. I have ...
How can I run IDLE for Python 3 in a Conda environment?
Also, in Windows 10 we can get an idle command by switching to the app installation of Python 3 from the Microsoft Store. For 3.7, this installs an idle command as an app-exec link, as well as idle3 and idle3.7.
If running idle.pyw directly doesn't work, then probably the file association is wrong. Make sure that assoc .pyw is set to Python.NoConFile and that the command for ftype Python.NoConFile has the args "%1" %*. Prior to 3.3 the default command runs pythonw.exe (make sure it's the right version), and for 3.3+ it runs pyw.exe.
Short answer Start the virtual environment Run python -m idlelib.idle From this answer. Long answer This answer assumes Python 3. There are a few different virtual environment managers, each of which has a slightly different way of handling where python is installed and how it's run, as detailed in this answer. This answer assumes the venv module is used, and that it was installed following ...