简体   繁体   中英

How to enable the "idle" command from Windows Command Prompt

I remember that at some point I used to be able open up the python IDLE from the command line by simply typing "idle" return, which would pop up the python idle editor. I recently got a new machine and installed python, but have to open idle from the windows start menu.

When trying to run "idle" or "idle3" from the command line I get

C:\Users\SSims>idle3
'idle3' is not recognized as an internal or external command,
operable program or batch file.

Can anyone tell me how to get the command line "idle" command set up. Thanks for any help!

There are no step-by-step fixes that I have found online to answer this question, but many that answer specific portions of the question scattered around online. Hopefully, this will help others with the same question in the future, as I know there are many who could benefit from this answer.

If you have selected "Add Python Xx to Path Variables" upon installation then you should be able to run "python" from the command line to start the python editor. Similarly, this will allow you to do the same for IDLE.

First, hit your windows key and type "path" then enter to go to your system environment page in settings.

在此处输入图片说明

Next, click "Environment Variables then select "Path" under user variables There should be a popup that contains a path that looks like this:

C:\\Users\\SSims\\AppData\\Local\\Programs\\Python\\Python37-32\\

Copy that address then click "new" Paste that address, then at the end of it type "Lib\\idlelib" so that your new variable now looks like:

C:\\Users\\SSims\\AppData\\Local\\Programs\\Python\\Python37-32\\Lib\\idlelib

This should be the path to the folder in which the idle executable file resides.

Note: You can check that path to ensure it is right by pasting it into the windows start menu and it should redirect you to the folder. If it doesn't, you can paste the path to the python folder from earlier that was added automatically upon installation and search around in there until you find the idle executable, then add that folder to the Path variables to get it to work.

You should now be able to run the idle command from command prompt, hope this helps!!

Instead of IDLE use, python -m idlelib command

check the IDLE official document

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM