Umbhobho, ufakelo kunye nesiseko sesi sixhobo ku-Ubuntu 20.04

Faka umbhobho ku-Ubuntu 20.04

Kwinqaku elilandelayo siza kujonga singazifaka njani kwaye sizilawule njani iiphakheji zePython sisebenzisa iPip kwi-Ubuntu 20.04. Esi sisixhobo sokufaka iiphakheji zePython. Ngayo siya kuba nakho ukukhangela, ukukhuphela kunye nokufaka iiphakeji kwiPython Index Package Index (I-PyPI) kunye nezinye izikhombisi zepakethe.

Kule migca ilandelayo siza kubona indlela yokufaka umbhobho wePython 3 kunye nePython 2 ku-Ubuntu 20.04. Siza kujonga ezinye zezinto ezisisiseko zokufaka kunye nokulawula iiphakheji zePython usebenzisa umbhobho. Kufuneka kuthiwe Njengobuntu buka-Ubuntu 20.04, i-Python 3 ibandakanyiwe kwinkqubo yesiseko, kwaye IPython 2 iyafumaneka ukuze ifakwe kwindawo yokugcina izinto ezikhoyo. Nangona ukusetyenziswa kwayo kungasacetyiswa kwaye abasebenzisi bayamenywa ukuba batshintshele kwiPython 3.

Xa ufaka iPython, Kuyacetyiswa ngamandla ukuba kufakelwe iphakheji yemodyuli yesixhobo kunye nesixhobo esifanelekileyonjengoko oku kuvavanyiwe ukusebenza ngokufanelekileyo kwiinkqubo Ubuntu. Kufuneka icace gca ukuba Iiphakheji zePython 3 zisebenzisa isimaphambili intuthu3- y Iipakethe zePython 2 ziyitshintshele kwi intuthu2-.

Ukuba ukhetha ukusebenzisa iPip kuphela kwimeko ebonakalayo. IPython Imeko eziBonakalayo Iya kukuvumela ukuba ufake iimodyuli zePython kwindawo eyodwa kwiprojekthi ethile, endaweni yokuba ifakwe kwilizwe jikelele. Ngale ndlela, asizukuba naxhala lokuchaphazela ezinye iiprojekthi.

Ukufaka iPip yePython 3

Ukuba sifuna faka umbhobho wePython 3 kwi-Ubuntu 20.04Kuya kufuneka sifeze le miyalelo ilandelayo kwisiphelo sendlela (Ctrl + Alt + T):

python3-pip ufakelo

sudo apt update && sudo apt install python3-pip

Lo myalelo ungasentla uya kufaka konke ukuxhomekeka okuyimfuneko ekwakheni iimodyuli zePython.

Xa ufakelo lugqityiwe, sinako qinisekisa ufakelo kwaye ujonge uhlobo olufakelweyo usebenzisa umyalelo:

Inguqulelo yepip3

pip3 --version

Inombolo yenguqulo inokuhluka, kodwa iya kujongeka ngakumbi okanye incinci njengoko ubona kwiscreen esingentla.

Ukufaka iPip yePython 2

Umbhobho wePython 2 awufakwanga kwindawo yokugcina izinto Ubuntu 20.04. Ukufakela umbhobho wePython 2 siza kusebenzisa iskripthi get-pip.py.

Ukuqala, kwaye ukuba awunayo loo nto, kuya kufuneka uyenze vumela indawo yokugcina izinto:

sudo add-apt-repository universe

Ngoku siza kuya Hlaziya isalathiso seephakeji ezikhoyo kwaye ufake iPython 2:

python2 ufakelo

sudo apt update && sudo apt install python2

Ngoku, sisebenzisa isixhobo esikhawulezayo, siza kuthi khuphela iskripthi fumana.ip:

Khuphela iscript esivela kumbhobho

curl https://bootstrap.pypa.io/get-pip.py --output get-pip.py

Nje ukuba ukhuphelo lugqityiwe, siya kuthi sebenzisa iskripthi nge-python2 ukufaka ipayipi:

Ukufakwa kombhobho

sudo python2 get-pip.py

Umbhobho uya kufakelwa kwihlabathi liphela. Ukuba unomdla wokufaka kuphela umsebenzisi wakho, sebenzisa umyalelo ngaphandle kweSudo. Iskripthi siza kufaka izixhobo zokusetha kunye nevili.

Ngoku sinako qinisekisa ufakelo ngokushicilela inombolo yenguqulo usebenzisa umyalelo:

Inguqulelo yepip2

pip2 --version

Ezinye iziseko zokusebenzisa iPip

Ngoku makhe sijonge eminye imiyalelo esisiseko yombhobho. Ngesi sixhobo singafaka iipakeji ezivela kwiPyPI, ulawulo lwenguqulo, iiprojekthi zasekhaya kunye nokusasazwa kweefayile.

ukuba jonga uluhlu lwayo yonke imiyalelo ekhoyo kunye neenketho Kufuneka ubhale:

ipip3 --help

pip3 --help

Sinako fumana ulwazi ngakumbi malunga nomyalelo othile usebenzisa umthetho Umbhobho- uncedo. Umzekelo, ukufumana ulwazi oluthe kratya malunga nomyalelo wokufaka, chwetheza nje:

ukufaka ipayipi -help

pip3 install --help

Faka iipakeji ngePip

Masithi sinomdla wokufaka iphakheji ebizwa ngokuba isandi, esetyenziselwa ukukhupha idatha kwiiwebhusayithi. Kuba faka ingxelo yokugqibela yempahlaKuya kufuneka usebenze lo myalelo:

pip3 install scrapy

ukuba faka ingxelo ethile yephakheji, kufuneka nje sidibanise == kunye nenombolo yenguqulo emva kwegama lephakheji:

pip3 install scrapy==1.5

Singayitshintsha i-pip3 nge-pip2 ukuba sisebenzisa iPython 2.

Hlaziya iphakheji

ukuba hlaziya iphakheji esele ifakiwe kuhlobo lwamva njeUmyalelo oza kusetyenziswa uya kuba yinto elandelayo:

pip3 install --upgrade nombre_paquete

Faka iiphakheji usebenzisa iimfuno zefayile

Ukuba sinefayile yokubhaliweyo enoluhlu lweephakeji zeepip kunye neenguqulelo zazo eziyimfuneko ukwenza iprojekthi ethile yePython. Siya kuba nakho ukusebenzisa lo myalelo ulandelayo kwi faka uluhlu lweemfuno ezichazwe kwifayile:

pip3 install -r requirements.txt

Uluhlu olufakelwe iipakeji

ukuba Dwelisa zonke iipakeji zombhobho ezifakiweKuya kufuneka ufake lo myalelo ulandelayo:

pip3 list

Khipha iiphakheji

ukuba khipha iphakheji, kufuneka usebenze into enje:

pip3 uninstall nombre_paquete

Ngolwazi oluthe kratya, abasebenzisi banako ndwendwela iphepha le Isikhokelo somsebenzisi okanye inqaku malunga nalo eyabhalwa kwithuba elidlulileyo kule bhlog.


Umxholo wenqaku uyabambelela kwimigaqo yethu imigaqo yokuziphatha yokuhlela. Ukuxela impazamo cofa apha.

Izimvo, shiya eyakho

Shiya uluvo lwakho

Idilesi yakho ye email aziyi kupapashwa. ezidingekayo ziphawulwe *

*

*

  1. Uxanduva lwedatha: UMiguel Ángel Gatón
  2. Injongo yedatha: Ulawulo lwe-SPAM, ulawulo lwezimvo.
  3. Umthetho: Imvume yakho
  4. Unxibelelwano lwedatha: Idatha ayizukuhanjiswa kubantu besithathu ngaphandle koxanduva lomthetho.
  5. Ukugcinwa kweenkcukacha
  6. Amalungelo: Ngalo naliphi na ixesha unganciphisa, uphinde uphinde ucime ulwazi lwakho.

  1.   UDaniel Miranda Rojas sitsho

    Ulwazi olugqwesileyo, ndifuna ngaphezulu malunga ne-python.