用於Windows的Python啟動器是一個實用程序,可協助定位和執行不同的Python版本。它允許腳本(或命令列)指示特定Python版本的首選項,並將定位並執行該版本。
與 PATH 變數不同,啟動器會正確選擇最合適的Python版本。它更傾向於按使用者安裝而不是系統安裝,並按語言版本排序,而不是使用最新安裝的版本。
啟動器最初是在PEP 397中指定的。
Python啟動的幾個方法:
#1、從命令列啟動Python
全域安裝Python 3.3及更高版本將把啟動器放在你的PATH上。啟動程序與所有可用的Python版本相容,因此安裝哪個版本無關緊要。若要檢查啟動程式是否可用,請在命令提示字元中執行下列命令:
py
會發現已安裝的最新版本的Python已啟動- 它可以正常退出,並且將指定的任何其他命令列參數直接發送到Python。
如果您安裝了多個版本的Python(例如,2.7和3.7 ),您會注意到Python 3.7 啟動- 如果您要啟動Python 2.7,嘗試命令:
py -2.7
如果您想使用Python 2.x 的最新版本,請嘗試以下指令:
py -2
你會發現Python 2.x 的最新版本已啟動。
如果您看到以下錯誤,則表示您沒有安裝啟動器:
'py' is not recognized as an internal or external command, operable program or batch file.
除非在安裝時選擇了該選項,單一使用者安裝的Python不會將啟動程式新增至 PATH 。
2、從腳本啟動Python
讓我們創建一個測試Python腳本- 創建一個名為``hello.py``的文件,其中包含以下內容
#! python import sys sys.stdout.write("hello from Python %s\n" % (sys.version,))
從hello.py所在的目錄中,執行以下指令:
py hello.py
您應該注意到最新的Python 2.x安裝的版本號碼已列印出來。現在嘗試將第一行更改為:
#! python3
現在,重新執行該命令應該會列印最新的Python 3.x資訊。與上面的命令列範例一樣,你可以更明確的指定版本限定符。假設您安裝了Python 2.6,請嘗試將第一行更改為 #! python2.6 ,您會發現列印的2.6版本資訊。
請注意,與互動式使用不同,裸「python」將使用您已安裝的Python 2.x的最新版本。這是為了向後相容及相容Unix,其中指令 python 通常是指Python 2。
3、從檔案關聯啟動Python
#安裝時應該將啟動器與Python檔案(即 .py, .pyw, .pyc文件)相關聯。這表示當您從Windows資源管理器中雙擊其中一個檔案時,將使用啟動程序,因此您可以使用上述相同的工具讓腳本指定應使用的版本。
這樣做的主要好處是,單一啟動程式可以同時支援多個Python版本,這取決於第一行的內容。
更多Python相關技術文章,請造訪Python教學欄位學習!
以上是python安裝後怎麼啟用的詳細內容。更多資訊請關注PHP中文網其他相關文章!

Pythonarrayssupportvariousoperations:1)Slicingextractssubsets,2)Appending/Extendingaddselements,3)Insertingplaceselementsatspecificpositions,4)Removingdeleteselements,5)Sorting/Reversingchangesorder,and6)Listcomprehensionscreatenewlistsbasedonexistin

NumPyarraysareessentialforapplicationsrequiringefficientnumericalcomputationsanddatamanipulation.Theyarecrucialindatascience,machinelearning,physics,engineering,andfinanceduetotheirabilitytohandlelarge-scaledataefficiently.Forexample,infinancialanaly

useanArray.ArarayoveralistinpythonwhendeAlingwithHomoGeneData,performance-Caliticalcode,orinterfacingwithccode.1)同質性data:arraysSaveMemorywithTypedElements.2)績效code-performance-calitialcode-calliginal-clitical-clitical-calligation-Critical-Code:Arraysofferferbetterperbetterperperformanceformanceformancefornallancefornalumericalical.3)

不,notalllistoperationsareSupportedByArrays,andviceversa.1)arraysdonotsupportdynamicoperationslikeappendorinsertwithoutresizing,wheremactsperformance.2)listssdonotguaranteeconecontanttanttanttanttanttanttanttanttanttimecomplecomecomplecomecomecomecomecomecomplecomectacccesslectaccesslecrectaccesslerikearraysodo。

toAccesselementsInapythonlist,useIndIndexing,負索引,切片,口頭化。 1)indexingStartSat0.2)否定indexingAccessesessessessesfomtheend.3)slicingextractsportions.4)iterationerationUsistorationUsisturessoreTionsforloopsoreNumeratorseforeporloopsorenumerate.alwaysCheckListListListListlentePtotoVoidToavoIndexIndexIndexIndexIndexIndExerror。

Arraysinpython,尤其是Vianumpy,ArecrucialInsCientificComputingfortheireftheireffertheireffertheirefferthe.1)Heasuedfornumerericalicerationalation,dataAnalysis和Machinelearning.2)Numpy'Simpy'Simpy'simplementIncressionSressirestrionsfasteroperoperoperationspasterationspasterationspasterationspasterationspasterationsthanpythonlists.3)inthanypythonlists.3)andAreseNableAblequick

你可以通過使用pyenv、venv和Anaconda來管理不同的Python版本。 1)使用pyenv管理多個Python版本:安裝pyenv,設置全局和本地版本。 2)使用venv創建虛擬環境以隔離項目依賴。 3)使用Anaconda管理數據科學項目中的Python版本。 4)保留系統Python用於系統級任務。通過這些工具和策略,你可以有效地管理不同版本的Python,確保項目順利運行。

numpyarrayshaveseveraladagesoverandastardandpythonarrays:1)基於基於duetoc的iMplation,2)2)他們的aremoremoremorymorymoremorymoremorymoremorymoremoremory,尤其是WithlargedAtasets和3)效率化,效率化,矢量化函數函數函數函數構成和穩定性構成和穩定性的操作,製造


熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

Video Face Swap
使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱門文章

熱工具

SublimeText3 英文版
推薦:為Win版本,支援程式碼提示!

VSCode Windows 64位元 下載
微軟推出的免費、功能強大的一款IDE編輯器

PhpStorm Mac 版本
最新(2018.2.1 )專業的PHP整合開發工具

WebStorm Mac版
好用的JavaScript開發工具

Dreamweaver CS6
視覺化網頁開發工具