The Python interpreter is usually installed as /usr/local/bin/python3.6 on those machines where it is available; putting /usr/local/bin in your Unix shell’s search path makes it possible to start it by typing the command:
python3.6
to the shell. [1] Since the choice of the directory where the interpreter lives is an installation option, other places are possible; check with your local Python guru or system administrator. (E.g., /usr/local/python is a popular alternative location.)
在类Unix系统中如Linux,Python解释器通常安装在 /usr/local/bin/python3.6目录,在shell中切换到python安装目录,在shell中输入:Python 3.6,启动python解释器,就可以来编写Python命令了。当然,您也可以选择安装到其他目录,与系统管理员检查哪里可以装,/usr/local/python也是一个常用的路径。
On Windows machines, the Python installation is usually placed in C:\Python36, though you can change this when you’re running the installer. To add this directory to your path, you can type the following command into the command prompt in a DOS box:
setpath=%path%;C:\python36
Windows系统中,Python常安装在C:\python36目录,当然您在安装时,也可以选择更改安装路径,安装好后,你可以在DOS窗口即命令行下输入set path=%path%;C:\python36来配置变量,让windows自动识别。设置好之后,就可以执行python命令了。
笔者补充:在winows中,如果您没有设置变量,或者是下载的免安装包,您可以通过输入路径的方式来执行Pyhon命令和脚本,比如python在F盘 输入F:\python-3.6.4\python F:\test\test.py 就可以执行F:\test\test.py脚本。
(Control-D on Unix, Control-Z on Windows) at the primary prompt causes the interpreter to exit with a zero exit status. If that doesn’t work, you can exit the interpreter by typing the following command: quit().
(通常你可以在UNIX,Windows在control-Z)主提示符解释器会以10状态退出。如果不工作,你可以退出解释器通过键入以下命令:quit()。