简体   繁体   English

从终端打开空闲

[英]Opening IDLE from Terminal

I'm new to programming and to be more specific, Python.我是编程新手,更具体地说,是 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".我正在经历从 Robert Sedgewick 的Python 编程简介网站到“下载和安装 Booksite 库”部分之前的安装过程。 My problem occurred with:我的问题发生在:

In the Terminal window issue the command idleX.Y (for example, idle2.7).在终端窗口中发出命令 idleX.Y(例如, idle2.7)。 If an IDLE window appears, then you have installed IDLE properly.如果出现 IDLE 窗口,那么您已经正确安装了 IDLE。 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 .在安装 Python 2.7 时,我尝试使用命令idle2.7 ,但收到以下响应 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.据我所知,我遵循了 Sedgewick 先生网站提供的所有说明,并且我已经确认 Python 已安装为 2.7.10 版。 After looking for answers online, I found a similar one here on Stack Overflow .在网上寻找答案后,我在 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).在这一点上,我应该提到我正在运行最新版本的 OS X (El Capitan) 的 MacBook Pro(2015 型号)上尝试此操作。

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:对于 2.7,以下内容,其中“python”是“启动 2.7 所需的任何字符串”(可能是“python”,也可能是“python2”),应该适用于任何操作系统:

python -m idlelib.idle

For 3.x, .idle can be omitted.对于 3.x,可以省略.idle In *nix (but not on Windows), python should probably be replaced by python3 .在 *nix (但不是在 Windows 上)中, python可能应该替换为python3 The usability of shortcut scripts such as 'idle2.7' depends on the script being both present and on the executable path.诸如“idle2.7”之类的快捷脚本的可用性取决于脚本的存在和可执行路径。 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.在去年,Python 核心开发人员已经从使用多种不可靠的快捷脚本转向python -m module ,只要可以启动特定版本的 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.在 Windows 上,我相信在 Mac 上,使用 PSF 安装程序后,如果有多个 python 安装, python可以替换为py -xpy -xy

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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