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()。