PIP - nqi hluav taws xob "Hais kom ua kab"tsim los ua haujlwm nrog PyPI cheebtsam. Yog tias qhov khoos kas no tau muab tso rau hauv computer, qhov no ua kom yooj yim rau kev txhim kho cov txheej txheem ntawm lwm qhov chaw sab nraud rau lub Python programming. Ntev raws li tau tsim kho dua tshiab, nws txoj cai tau txais kev pom zoo thiab muaj kev nrhau ntxiv. Tom ntej, peb yuav saib cov txheej txheem rau kev muab kho dua cov dej siv ob txoj kev.
Hloov PIP rau Python
Lub kaw lus tswj lub pob yuav ua hauj lwm kom yog thaum nws cov ntaub ntawv ruaj khov siv. Periodically, software components hloov lawv cov tsos, vim tias lawv yuav tsum tau muab kho thiab PIP. Cia peb saib ob hom kev txhim kho kev tsim kho tshiab uas yuav tsim nyog rau qee lub sijhawm.
Txoj kev 1: Download ib tug tshiab version ntawm Python
PIP yog ntsia rau hauv PC nrog Python downloaded los ntawm lub xeem site. Yog li no, qhov kev hloov tshiab yooj yim yog mus download tau qhov tseeb Nab hab sej. Ua ntej no, nws tsis tas yuav lwv qhov qub, koj tuaj yeem tso ib lub tshiab rau saum lossis txuag cov ntaub ntawv nyob rau lwm qhov chaw. Ua ntej, peb pom zoo kom nco ntsoov tias qhov kev tsim kho ntawm ib qho qauv tshiab yog tsim nyog. Ua li no, ua cov yeeb yam nram qab no:
- Qhib lub qhov rai Khiav mus los ntawm nias qhov tseem ceeb ua ke Yeej + Rsau ntawv
cmd
thiab nias Sau. - Nyob rau hauv lub qhov rais tso tawm kom pom "Hais kom ua kab" koj yuav tsum sau cov lus qhia hauv qab no thiab nias rau Sau:
Nab hab sej - version
- Koj yuav pom tus nab hab Python tam sim no. Yog tias nws qis tshaj qhov tam sim no (thaum sau lub sijhawm no 3.7.0), ces nws tuaj yeem kho tshiab.
Cov txheej txheem rau daus thiab unpacking tus tshiab version yog raws li nram no:
Mus rau qhov website Python
- Mus rau qhov website Python ntawm qhov chaw txuas los yog los ntawm kev tshawb fawb hauv txhua qhov yooj yim browser.
- Xaiv ib seem "Downloads".
- Nias ntawm qhov tsim nyog khawm mus rau ntawm cov ntaub ntawv muaj cov ntaub ntawv.
- Hauv daim ntawv, qhia lub rooj sib txoos thiab kev kho dua tshiab uas koj xav muab tso rau hauv koj lub computer.
- Lub tshuab nruab nrab yog muab faib rau hauv cov ntaub ntawv, hauv daim ntawv ntawm ib qho offline lossis hauv internet nruab. Nyob rau hauv daim ntawv teev, nrhiav ib txoj kev tsim thiab nyem rau ntawm nws lub npe.
- Tos kom txog thaum lub download tau tiav thiab khiav cov ntaub ntawv.
- Nco ntsoov zuam lub thawv "Ntxiv nab hab sej 3.7 ces PATH". Vim qhov no, qhov kev zov me nyuam yuav raug muab ntxiv rau daim ntawv teev cov kev hloov zog.
- Teem hom installation "Customize installation".
- Tam sim no koj yuav pom ib daim ntawv teev npe ntawm tag nrho cov khoom muaj. Nco ntsoov tias qhov khoom ntawd yog "txhuam" qhib rua, ces nias rau "Tom ntej".
- Kos rau qhov tsis tsim nyog ntxiv thiab xaiv qhov chaw ntawm cov khoom software.
Peb qhia koj kom muab Python tso rau hauv lub hauv paus ntawm qhov kev faib tawm ntawm qhov nyuaj disk.
- Tos rau lub installation kom tiav. Thaum lub sijhawm no, tsis txhob kaw lub tshuab nruab ntug thiab tsis txhob rov qab qhib lub PC.
- Koj yuav raug ceebtoom tias txoj haujlwm tau ua tiav tiav.
Tam sim no tus PIP hais kom ua los ntawm pob tswj qhov system nrog tib lub npe yuav ua hauj lwm kom raug nrog txhua qhov ntxiv thiab cov tsev qiv ntawv. Tom qab lub installation tiav, koj tuaj yeem mus rau lub chaw tso dej thiab cuam tshuam nrog nws.
Txoj kev 2: Kev Cuam Tshuam PIP Hloov tshiab
Qee lub sij hawm txoj kev muab kho dua tas nrho Python kom tau ib tug tshiab version ntawm PIP tsis haum vim hais tias ntawm uselessness ntawm no tus txheej txheem. Hauv qhov no, peb pom zoo muab dai daim ntawv tivthaiv kev tivthaiv ntawm tes, thiab tom qab txhaj tshuaj rau hauv qhov kev pab cuam thiab txav mus ua haujlwm. Koj yuav tsum ua li ob peb tug neeg xwb:
Mus rau PIP download nplooj
- Mus rau ntawm daim PIP download nplooj ntawm qhov link saum toj no.
- Txiav txim siab rau qhov tsim nyog version ntawm qhov peb npaj siab.
- Txav mus rau qhov chaws los ntawm txhaj rau lub npe "tau-pip.py".
- Koj yuav pom tag nrho cov cai ntawm cov txheej txheem pob. Txoj cai-nias qhov twg thiab xaiv "Txuag Raws Li ...".
- Qhia meej rau qhov chaw yooj yim ntawm lub tshuab computer thiab khaws cov ntaub ntawv muaj. Nws lub npe thiab hom yuav tsum tsis txhob hloov tsis tau.
- Xauj rau cov ntaub ntawv hauv PC, txoj cai-nias rau ntawm nws thiab xaiv "Cov khoom".
- Nrog cov laug nas khawm tuav, xaiv kab "Qhov chaw" thiab luam nws los ntawm txhaj rau Ctrl + C.
- Khiav lub qhov rais Khiav mus kub tuav Yeej + Rnkag mus rau qhov ntawd
cmd
thiab nias rau "OK". - Nyob rau hauv lub qhov rais qhib, sau qhov kev hais kom ua
cd
thiab ces muab tshuaj rau yav dhau los uas tau siv ua ke Ctrl + V. Nias rau Sau. - Koj yuav raug xa mus rau cov npe xaiv tsa uas cov ntaub ntawv tsim nyog tau txais kev cawmdim. Tam sim no nws yuav tsum tau ntsia hauv Python. Ua li no, sau thiab qhib cov lus txib nram qab no:
Python tau-pip.py
- Lub download thiab installation yuav pib. Thaum lub sijhawm ua haujlwm no, tsis txhob kaw lub qhov rai lossis ntaus yam dab tsi hauv.
- Koj yuav tau txais ntawv ceeb toom ntawm kev ua tiav ntawm qhov kev txhim kho, qhov no kuj tau qhia los ntawm cov tswv yim tso tawm teb.
Qhov no ua tiav cov txheej txheem hloov tshiab. Koj tuaj yeem siv lub fais fab siv, download tau ntxiv cov khoom siv thiab cov tsev qiv ntawv. Txawm li cas los xij, yog tias muaj cov xwm txheej tshwm sim thaum nkag mus rau hauv cov lus txib, peb pom zoo ua cov yeeb yam nram no, thiab rov qab mus "Hais kom ua kab" thiab pib qhov PIP installation.
- Qhov tseeb yog tias nws tsis yog ib txwm thaum unpacking sej ntawm sib txawv assemblies uas system zog ntxiv. Qhov no feem ntau yog vim kev tsis txaus siab ntawm cov neeg siv. Yuav kom manually tsim cov ntaub ntawv no, ua ntej mus rau lub tshuab raj. "Pib"qhov twg rmm nias rau "Khoos phib tawj" thiab xaiv yam khoom "Cov khoom".
- Ntawm sab laug yuav muaj ob peb seem. Mus rau "Cov txheej txheem siab tshaj".
- Hauv tab "Qib Siab" nyem rau "Ib puag ncig hloov ...".
- Tsim kom muaj kev sib txawv ntawm qhov system.
- Muab nws lub npe
Pythonpath
, hauv qhov nqi nkag rau kab hauv qab no thiab nias rau "OK".C: Python№ Lib; C: Python№ DLLs; C: Python№ Lib lib-tk; C: lwm-foolder-rau-tus-txoj
Qhov twg C: - qhov nyuaj disk qhov twg qhov Python№ nplaub tshev nyob.
Python - qhov directory directory (Lub npe hloov nyob ntawm tus ntsia nruab nrab).
Tam sim no koj tuaj yeem kaw tag nrho cov qhov rais, rov qab qhib koj lub computer thiab rov pib dua ob txoj kev kho dua tshiab ntawm PIP pob.
Lwm txoj kev ntxiv cov ntawv nyeem
Tsis yog txhua tus neeg tuaj yeem hloov PIP thiab siv nws cov cuab yeej built-in los ntxiv rau cov Python. Tsis tas li ntawd xwb, tsis yog tag nrho cov qauv ntawm qhov kev zov me nyuam ua hauj lwm zoo nrog rau qhov no. Yog li, peb xav kom siv lwm txoj kev uas tsis tas yuav tsum tau ua cov installation ntxiv tom ntej. Koj yuav tsum tau ua cov hauv qab no:
- Mus rau ntawm qhov chaw kawm module thiab download tau lawv ua ib qho kev kos archive.
- Qhib cov npe los ntawm tej qhov yooj yim archiver thiab unpack tus txheem mus rau hauv txhua daim nplaub tshev npliag ntawm koj lub PC.
- Mus rau cov ntaub ntawv unpacked thiab pom muaj. Setup.py. Nias rau ntawm sab xis nrog nas khawm thiab xaiv "Cov khoom".
- Luam lossis cim nws qhov chaw.
- Khiav mus "Hais kom ua kab" thiab los ntawm kev ua haujlwm
cd
mus rau hauv phau ntawv theej. - Ntaus cov lus txib nram qab no thiab qhib nws:
Python setup.py nruab
Nws tseem tshua tsuas tos kom tiav ntawm lub installation, tom qab uas koj tuaj yeem mus ua haujlwm nrog lub modules.
Raws li koj pom, PIP cov txheej txheem hloov tshiab yog qhov nyuaj, tab sis txhua yam yuav tsum tawm yog tias koj ua raws li cov lus qhia saum toj no. Yog tias PIP chaw ua hauj lwm tsis ua hauj lwm los yog tsis kho tshiab, peb tau npaj siab ua lwm txoj hau kev rau kev txhim kho cov tsev qiv ntawv, feem ntau yog kev ua hauj lwm zoo.