Otu esi etinye asụsụ mmemme Swift na Debian 11 Bullseye

Swift, nke a na-akpọkarị "Ebumnobi-C, enweghị C," bụ asụsụ mmemme mepere emepe mebere ma na-echekwa ya Apple. Swift bụ izugbe-nzube asụsụ mmemme wuru site na iji nchekwa ọgbara ọhụrụ, arụmọrụ yana ụkpụrụ imewe sọftụwia. Ihe oru Swift bu n'obi imepụta asusu kacha mma maka mmemme sistemu na ngwa mkpanaka na desktọpụ, na-abawanye ruo ọrụ igwe ojii.

N'ime nkuzi a, ị ga-amụta Otu esi etinye Swift na Debian 11 Bullseye.

Prerequisites

  • OS akwadoro: Nnenna 11 Bullseye
  • Akaụntụ onye ọrụ: Akaụntụ onye ọrụ nwere sudo ihe ùgwù or ohere mgbọrọgwụ (su Command).
  • Ngwungwu achọrọ: wget

Na-emelite Sistemụ Ọrụ

Melite gi Debian 11 Sistemụ arụmọrụ iji hụ na ngwugwu niile dị adị adịla ugbu a:

sudo apt update && sudo apt upgrade

Mgbọrọgwụ ma ọ bụ Sudo Access

Site na ndabara, mgbe ị mepụtara akaụntụ gị na mmalite na Debian ma e jiri ya tụnyere nkesa ndị ọzọ, ọ naghị enweta ọkwa sudoers ozugbo. Ị ga-enwerịrị ike ịnweta ya mgbọrọgwụ paswọọdụ iji iwu su ma ọ bụ gaa na nkuzi nkuzi anyị Otu esi etinye onye ọrụ na Sudoers na Debian.


Advertisement


Wụnye Eke Ọgba 3.8

Iji jiri Swift na Debian 11, ị ga-achọ ịwụnye Python 3.8. Ebe ọ bụ na nke a adịghị na Debian 11 n'ọbá akwụkwọ ndabara, ị ga-achọ ịchịkọta site na ọkọ, mana usoro a dị nnọọ mfe. Ị ga-achọ ịga na ibe nbudata ọrụ Python iji nweta ụdị kachasị ọhụrụ; n'oge e kere ntuziaka a, ọ bụ 3.8.12, ma ka oge na-aga nke a ga-agbanwe, jide n'aka na ị na-enyocha mmelite n'ọdịnihu ma na-emegharị usoro a.

Ozugbo ị nwetara njikọ nbudata, jiri ya wget iwu ka ibudata Python 3.8 Archive:

wget https://www.python.org/ftp/python/3.8.12/Python-3.8.12.tar.xz

Wepụ ebe nchekwa Python. Cheta, gbanwee nọmba ụdị ma ọ bụrụ na ibudatara nke ọhụrụ:

tar -xf Python-3.8.12.tar.xz
mv Python3.8.12 /opt/Python3.8.12

Ugbu a wụnye ndabere achọrọ iji wụnye Python 3.8:

sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libsqlite3-dev libreadline-dev libffi-dev curl libbz2-dev -y

Gaa na ndekọ ma mee ya ./configure –enable-optimizations iwu:

cd /opt/Python3.8.12/
./configure --enable-optimizations --enable-shared

Mara, Edemede a na-eme ọtụtụ nyocha iji hụ na ndabere niile na sistemụ gị dị. Nke ./configure –enable-optimizations ga-ebuli ọnụọgụ abụọ Python site n'ịgba ọtụtụ ule, nke ga-eme ka usoro nhazi ahụ dị nwayọọ.

Ugbu a ị wulitela ma hazie gburugburu, ọ bụ oge iji iwu ahụ chịkọta ya -eme ka.

make

Aghụghọ dị mma bụ ịkọwapụta ya -j n'ihi na nke a nwere ike ịbawanye ọsọ nke mkpokọta ma ọ bụrụ na ị nwere ihe nkesa dị ike. Dịka ọmụmaatụ, LinuxCapable nkesa nwere 6 CPUs, enwere m ike iji 6 niile ma ọ bụ opekata mpe jiri 4 ruo 5 mee ka ọsọ ọsọ.

make -j 6

Ozugbo ịmechara ụlọ, wụnye Python binaries dị ka ndị a:

sudo make altinstall

Mara, a na-adụ ọdụ ka ị jiri ya mee altinstall iwu KA KWESỊRỊ idegharị usoro ọnụọgụ abụọ Python 3 ndabara.

Na-esote, mgbe echichi ahụ gasịrị, ịkwesịrị ịhazi njikọ njikọ oge na-arụ ọrụ ike:

sudo ldconfig /opt/Python-3.8.12

Kwado na etinyere Python 3.8 yana ụdị nrụpụta site na iji iwu a:

python3.8 – mgbanwe

Ihe atụ mmepụta:

Python 3.8.12

Budata Swift

Swift enweghị ngwugwu Debian dị maka ịwụnye; Otú ọ dị, iji nweta Swift nke ọma na Debian, ị nwere ike iwunye ngwugwu Ubuntu site na ebe nchekwa Swift, nke ga-arụ ọrụ. Ka ibudata Swift, gaa na onye ọrụ download page nke nwere ụdị kachasị ọhụrụ edepụtara. Ka oge na-aga, ndị a ga-agbanwe, mana nkuzi ga-eji ihe atụ nke otu esi ebudata Ụdị Swift na-ewu 5.4.2 jiri ya wget nye iwu dika ndi a:

wget https://swift.org/builds/swift-5.4.2-release/ubuntu2004/swift-5.4.2-RELEASE/swift-5.4.2-RELEASE-ubuntu20.04.tar.gz

Na-esote, gbaa iwu a ka ịwụnye ndabere achọrọ:

sudo apt install binutils git gnupg2 libc6-dev libcurl4 libedit2 libgcc-9-dev libpython2.7 libsqlite3-0 libstdc++-9-dev libxml2 libz3-dev pkg-config tzdata zlib1g-dev -y

Advertisement


Wụnye Swift

Usoro nhazi ahụ dị ngwa ngwa ma dị mfe. Nke mbụ, ị ga-achọ iwepụta Archive dị ka ndị a:

tar -xvzf swift-5.4.2-RELEASE-ubuntu20.04.tar.gz

Na-esote, bugharịa ndekọ ewepụtara gaa na / pụọ ọnọdụ site na iji iwu a:

sudo mv swift-5.4.2-RELEASE-ubuntu20.04 /opt/swift

Ọzọ, ị ga-achọ ibudata ya mbinye aka GPG iji chọpụta izi ezi nke nbudata. Iji mee nke a, jiri ihe ndị a:

wget -q -O - https://swift.org/keys/all-keys.asc | sudo gpg --import -

Mwepụta ihe atụ ma ọ bụrụ na ọ ga nke ọma:

gpg: Total number processed: 8
gpg:               imported: 7
gpg:         new signatures: 1

Ugbu a ịkwesịrị ibupụ ụzọ nke Swift na .bashrc faịlụ dị ka ndị a:

echo "export PATH=/opt/swift/usr/bin:$PATH" >> ~/.bashrc

Ozugbo ụzọ na-exported, ị nwere ike ịgbalite .bashrc jiri iwu na-esonụ faịlụ:

source ~/.bashrc

Iji mechie nrụnye, nyochaa ụdị ma wuo:

swift --version

Ị ga-enweta mmepụta yiri ya:

Swift version 5.4.2 (swift-5.4.2-RELEASE)
Target: x86_64-unknown-linux-gnu

Mara, ị ga-achọ ka esi na ya pụọ mgbọrọgwụ iji iwu a.

Mgbe echichi ahụ gasịrị, ịkwesịrị ịhazi njikọ njikọ oge na-arụ ọrụ ike:

sudo ldconfig /usr/swift/lib/python3

Jikọọ na Swift REPL

Iji jikọọ na Swift Enwere ike nweta REPLL (Gụọ Eval Print Loop) site na iji iwu a:

swift

Ị nwere ike dee nke ọma Okwu ngwa ngwa n'ọnụ ọnụ a wee hụ ka a na-enyocha ha, ị nwekwara ike iji ụlọ akwụkwọ C ọkọlọtọ site na ibubata GNU C Libary.

N'okpuru bụ ụfọdụ isi atụ nke Swift n'ọrụ:

Otu esi etinye asụsụ mmemme Swift na Debian 11 Bullseye

I wepu the Swift Terminal, jiri iwu a:

:q

Advertisement


Okwu na mmechi

N'ime nkuzi, ị mụtala otu esi etinye ya Swift asụsụ mmemme site na nbudata na ibubata igodo PGP, wepụ bash na ụzọ achọrọ, yana iwu ndị bụ isi iji nweta mmetụta maka Ọnụ ọnụ ngwa ngwa.

4 echiche na "Otu esi etinye asụsụ mmemme Swift na Debian 11 Bullseye"

  1. Joshua,

    Daalụ maka ndu; wuo ihe ịga nke ọma, ma n'atụghị egwu mgbe m nwara ịwụnye m nwetara ozi "ỊDỌ AKA NA NTỊ: Ịgba ọsọ dị ka mgbọrọgwụ ga-agbaji ngwugwu na ikike. Ịkwesịrị ịwụnye ngwugwu nke ọma site na iji venv: https://pip.pypa.io/warnings/venv… Ma na-eso nke ahụ, mgbe m nwara ịgba ọsọ “python3.8 –version” enwetara m azịza “python3.8: njehie mgbe ị na-ebunye ọba akwụkwọ nkekọrịta: libpython3.8.so.1.0: enweghị ike imepe faịlụ ihe ekekọrịtara: Ọ nweghị faịlụ dị otú ahụ. ma ọ bụ akwụkwọ ndekọ aha."

    Enweghị nrụnye Python 3.8 na-arụ ọrụ, ana m eche na Ubuntu Swift install agaghị aga ebe ọ bụla. Ị tụlere ịnwale tweak Swift wụnye iji Python 3.9 kama?

    zaghachi
    • Ndewo Frank,

      Echefuru m akụkụ ahụ sudo ldconfig /opt/Python-3.8.12.

      Nke a kwesịrị idozi okwu nke nbudata nke ọba akwụkwọ nkekọrịta, m ga-agbakwunye nke a. Naanị nwalere nke a ma ọ na-arụ ọrụ na njedebe m na nrụnye Debian 11 ọhụrụ. Maka ugbu a, m kwenyere na anyị nwere ike iji Python 3.8 na Swift site na ihe m hụrụ ma ọ bụrụ na mmadụ nwere ike igosi m ọzọ. Emebere ebe nchekwa ebudatara na mbụ na Ubuntu n'uche, wee nye ụdị LTS nke Ubuntu 20.04 bụ ndị ọrụ Debian 3.8 nwere ike iji 3.8 naanị ma ọ bụrụ na nke a nwere ezi uche. Ama m na ọ na-akpasu iwe n'ịgbasawanye ihe.

      https://www.linuxcapable.com/how-to-install-python-3-8-on-debian-11-bullseye/

      Mee ka m mara ma ọ bụrụ na nke a anaghị arụ ọrụ, lelee ntuziaka m depụtara kwa ma ọ bụrụ na m tụfuru ihe n'ụzọ zuru ezu nke ga-ekwe omume naanị mmadụ ebe a.

      zaghachi
  2. Joshua, mgbakwunye gị nke “sudo ldconfig…” iwu rụrụ ọrụ - ọ bụ ezie na m ga-achọ igosi na ị nwere ụfọdụ typos na mgbanwe gị na ibe: Ị na-egosipụta ebe ntinye Python na iwu CLI gị dị ka “Python3.8.12. 3.8.12" mgbe ọ n'ezie kwesịrị na-agụnye a hyphen, dị ka "Python-3.8.12"… M jisiri na-arụ ọrụ na gburugburu a ma ị nwere ike imezi ya maka abamuru nke ndị ọzọ. Enwere m Python XNUMX arụnyere na m ga-aga n'ihu na Swift na-esote… Daalụ maka nzaghachi ngwa ngwa!

    zaghachi
    • Ọ dị egwu ịnụ, yana daalụ maka ịkọwapụta typo na ihe efu "-" edobere m nke a na nkuzi na nzaghachi m. Obi dị m ụtọ na ọ rụrụ ọrụ Frank 🙂

      zaghachi

Ahapụ a Comment