简体   繁体   中英

Opening IDLE from Terminal

I'm new to programming and to be more specific, Python. I was going through the installation process from Robert Sedgewick's Introduction to Programming in Python website until right before the section "Downloading and Installing the Booksite Library". My problem occurred with:

In the Terminal window issue the command idleX.Y (for example, idle2.7). If an IDLE window appears, then you have installed IDLE properly. Close the IDLE window.

As I was installing Python 2.7, I attempted to use the command idle2.7 , but I received the following response . As far as I can tell, I followed all of the directions provided by Mr. Sedgewick's website and I have already verified that Python was being installed as version 2.7.10. After looking for answers online, I found a similar one here on Stack Overflow . Unfortunately, the potential solutions listed for that question didn't help resolve my issue. At this point, I should mention that I am trying this on a MacBook Pro (2015 model) running the latest version of OS X (El Capitan).

Thanks for your help!

For 2.7, the following, where 'python' is 'whatever string needed to start 2.7' (perhaps 'python', perhaps 'python2'), should work on any OS:

python -m idlelib.idle

For 3.x, .idle can be omitted. In *nix (but not on Windows), python should probably be replaced by python3 . The usability of shortcut scripts such as 'idle2.7' depends on the script being both present and on the executable path. That, in turn, depends on the specific installers. In the last year, Python core developers have veered away from the use of a multiplicity of short-cut scripts, which are not dependable, toward python -m module , which is dependable as long as one can start a particular version of Python. On Windows and, I believe on Mac, after using the PSF installers, python can be replaced by py -x or py -xy if one has multiple python installations.

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