3 Txoj Kev Txhim Kho Python

Cov txheej txheem:

3 Txoj Kev Txhim Kho Python
3 Txoj Kev Txhim Kho Python

Video: 3 Txoj Kev Txhim Kho Python

Video: 3 Txoj Kev Txhim Kho Python
Video: Tsis Muaj Peev Xwm Yuav Ua Li Cas 2024, Tej zaum
Anonim

Nab hab sej yog txhais lus, hom phiaj-hom lus, qib lus qib siab uas yog qhov chaw zoo rau cov pib siv pib kawm paub yuav ua li cas. Python los teeb tsa ntawm Macs thiab nrog Linux, tab sis koj yuav tsum tau teeb tsa nws tus kheej yog tias koj siv Windows. Yog tias koj siv Mac lossis lub khoos phis tawj Linux, koj tuaj yeem nruab qhov hloov tshiab kawg kom ntseeg tau tias koj muaj kev nkag tau mus rau qhov tshiab kawg.

Cov kauj ruam

Txoj Kev 1 ntawm 3: Windows

3574533 1
3574533 1

Kauj Ruam 1. Mus ntsib Python lub vev xaib

Koj tuaj yeem rub tawm txhua yam koj xav tau kom pib nrog Python los ntawm Python lub vev xaib (python.org/downloads. Lub vev xaib yuav tsum txiav kom pom tau tias koj siv Windows thiab nthuav qhia cov txuas rau Windows installer.

3574533 2
3574533 2

Kauj Ruam 2. Xaiv qhov version uas koj xav kom nruab

Tam sim no muaj ob txoj kev Python muaj: 3.x.x thiab 2.7.10. Python ua rau ob qho tib si muaj los rub tawm, tab sis cov neeg siv tshiab yuav tsum xaiv 3.x.x version. Rub tawm 2.7.10 yog tias koj yuav tau ua haujlwm nrog txoj cai Python txoj cai lossis nrog cov haujlwm thiab cov tsev qiv ntawv uas tseem tsis tau saws 3.x.x.

Phau ntawv qhia no yuav xav tias koj tab tom txhim kho 3.x.x

3574533 3
3574533 3

Kauj Ruam 3. Khiav lub installer tom qab rub tawm nws

Nyem rau lub pob rau qhov koj xav tau yuav rub tawm lub installer rau nws. Khiav lub installer no tom qab nws tau ua tiav rub tawm.

3574533 4
3574533 4

Kauj Ruam 4. Kos rau lub thawv "Ntxiv Python 3.5 rau PATH"

Qhov no yuav tso cai rau koj los khiav Python ncaj qha los ntawm Command Prompt.

3574533 5
3574533 5

Kauj Ruam 5. Nyem "Nruab Tam Sim No"

Qhov no yuav teeb tsa Python nrog txhua qhov ntawm nws qhov chaw teeb tsa, uas yuav tsum zoo rau cov neeg siv feem ntau.

Yog tias koj xav kom xiam qee yam haujlwm, hloov cov npe teeb tsa, lossis teeb tsa lub debugger, nyem "Customize installation" hloov dua siab tshiab thiab tom qab ntawd kos lossis rho tawm lub thawv

3574533 6
3574533 6

Kauj Ruam 6. Qhib tus neeg txhais lus nab nab

Txhawm rau txheeb xyuas tias Python tau teeb tsa thiab ua haujlwm raug, qhib tus txhais lus tshiab uas tau teeb tsa. Nyem rau Start button thiab ntaus "nab nab" kom qhib sai.

3574533 7
3574533 7

Kauj Ruam 7. Sim tawm cov ntawv xeem

Nab hab sej yuav qhib rau kab hais kom ua. Ntaus cov lus txib hauv qab no thiab nias ↵ Sau kom pom "Nyob zoo ntiaj teb!" ntawm qhov screen:

print ('Nyob zoo ntiaj teb!')

3574533 8
3574533 8

Kauj Ruam 8. Qhib IDLE ib puag ncig kev txhim kho

Python los nrog kev txhim kho ib puag ncig hu ua IDLE. Qhov no tso cai rau koj los khiav, sim, thiab debug cov ntawv sau. Koj tuaj yeem tso IDLE sai sai los ntawm kev qhib Start menu thiab tshawb rau "tsis ua haujlwm".

3574533 9
3574533 9

Kauj Ruam 9. Kawm txuas ntxiv Python

Tam sim no koj tau txheeb xyuas tias Python tau teeb tsa thiab ua haujlwm, koj tuaj yeem pib kawm paub siv nws li cas. Saib Yuav Pib Li Cas Programming hauv Python rau qee cov lus qhia ntawm kev kawm yuav siv Python li cas.

Txoj kev 2 ntawm 3: Mac

3574533 10
3574533 10

Kauj Ruam 1. Txiav txim siab yog tias koj xav teeb tsa Python 3.x.x

Txhua lub khoos phis tawj ntawm OS X tuaj nrog Python 2.7 twb tau teeb tsa. Yog tias koj tsis xav tau qhov tshiab ntawm Python, koj tsis tas yuav teeb tsa dab tsi. Yog tias koj xav tau nkag mus rau cov kho tshiab tshiab ntawm Python, koj yuav xav nruab 3.x.x.

Yog tias koj tsuas yog xav siv cov ntawv suav nrog Python, koj tuaj yeem tsim cov ntawv sau hauv cov ntawv sau thiab ua kom lawv hla lub davhlau ya nyob twg

3574533 11
3574533 11

Kauj Ruam 2. Rub tawm Python 3.x.x cov ntaub ntawv los ntawm Python lub vev xaib

Mus ntsib (python.org/downloads ntawm koj Mac. Nws yuav tsum txheeb xyuas koj lub operating system thiab qhia Mac cov ntaub ntawv teeb tsa. Yog tias nws tsis yog, nyem qhov txuas "Mac OS X".

3574533 12
3574533 12

Kauj Ruam 3. Nyem ob npaug rau rub tawm PKG cov ntaub ntawv los pib txhim kho Python

Ua raws li cov lus qhia kom nruab Python. Cov neeg siv feem ntau tsuas tuaj yeem siv lub chaw teeb tsa ua ntej.

3574533 13
3574533 13

Kauj Ruam 4. Tua Python hauv lub davhlau ya nyob twg

Txhawm rau txheeb xyuas tias kev teeb tsa mus tau zoo, tso lub davhlau ya nyob twg thiab ntaus python3. Qhov no yuav tsum pib Python 3.x.x interface, thiab tso saib cov version.

3574533 14
3574533 14

Kauj Ruam 5. Qhib IDLE ib puag ncig kev txhim kho

Txoj haujlwm no tso cai rau koj sau thiab ntsuas Python cov ntawv. Koj tuaj yeem pom nws hauv Daim Ntawv Thov Cov Ntawv.

3574533 15
3574533 15

Kauj Ruam 6. Sim tawm cov ntawv xeem

IDLE yuav qhib ib puag ncig zoo ib yam li lub davhlau ya nyob twg. Ntaus cov lus txib hauv qab no thiab nias ↵ Sau kom pom "Nyob zoo ntiaj teb!":

print ('Nyob zoo ntiaj teb!')

3574533 16
3574533 16

Kauj Ruam 7. Pib siv Python

Tam sim no Python tau teeb tsa, koj tuaj yeem pib siv nws los kawm paub yuav ua haujlwm li cas. Saib Yuav Pib Li Cas Programming hauv Python rau cov lus qhia ntxiv rau Python pib

Txoj Kev 3 ntawm 3: Linux

3574533 17
3574533 17

Kauj Ruam 1. Txheeb xyuas qhov version ntawm Python koj twb tau teeb tsa

Yuav luag txhua qhov kev faib khoom ntawm Linux los nrog Python teeb tsa. Koj tuaj yeem pom dab tsi version koj muaj los ntawm qhib Terminal thiab ntaus nab hab sej.

3574533 18
3574533 18

Kauj Ruam 2. Nruab qhov hloov tshiab tshaj plaws hauv Ubuntu

Qhib Terminal qhov rai thiab ntaus sudo apt-tau nruab sej.

Koj tseem tuaj yeem nruab Python siv Ubuntu's Add/Remove Applications app nyob hauv Cov Ntawv Thov Qhov rai

3574533 19
3574533 19

Kauj Ruam 3. Nruab qhov tshiab tshaj plaws hauv Red Hat thiab Fedora

Qhib Terminal qhov rai thiab ntaus sudo yum nruab sej.

3574533 20
3574533 20

Kauj Ruam 4. Nruab qhov tshiab tshaj plaws hauv Arch Linux

Nkag mus raws li tus neeg siv hauv paus. Ntaus pacman -S nab hab sej.

3574533 21
3574533 21

Kauj Ruam 5. Rub tawm IDLE ib puag ncig

Yog tias koj xav siv Python kev txhim kho ib puag ncig, koj tuaj yeem tau txais nws los ntawm kev siv koj li kev faib khoom tus tswj software. Tsuas yog tshawb "python idle" txhawm rau nrhiav thiab teeb tsa pob.

3574533 22
3574533 22

Kauj Ruam 6. Kawm paub yuav ua haujlwm li cas hauv Python

Tam sim no koj tau hloov kho Python tshiab kawg, koj tuaj yeem pib kawm paub siv nws li cas rau program. Saib Yuav Pib Li Cas Programming hauv Python rau qee cov lus qhia ntawm kev kawm Python.

Pom zoo: