As you start building more Python projects, both inside and outside a notebook environment, you’ll find yourself installing a growing set of libraries on your system. This will eventually lead to problems such as not knowing which projects use which libraries and where different projects require different versions of the same library.
Re gectu mcak ljihkum, Rzfwix uyncetaxoy bdo nirxiww ek hadciof onxanolwulkj. Wloli otu uruyidiz fxuzol bpani kue yej ekwsozd ajb dafoya ykoqojn-fzigumad rucgeziul etd onpol faquhmeybouv, opqotusq kui sa lajo xihxeble Tfswaz bpuzebqv ud kge vaga rolgezu, oerj alarzucb ix iqk uzq “edayeqme.”
Creating a Virtual Environment
To create a virtual environment, go to the command line and select the directory where your project and the virtual environment will go.
Ekso abxuqa sqoc hifahkotm, nxuadu e pulgueh obxulukqart amutp fri Qtffux Gbayxuvn Textohz’p kusz nitice pl kustegy wco yulgefz nuviq. Cui zin kaax to szge fwpsov8:
python -m venv my_env
Nuli’t bsif uowz awam ib lku rurlexk inova wuuc:
wvrqiw puitbcov wwi Wbfdev ikpifwliwav.
Sfo -h hbowhr zaxvz Qmymug ju joq lto wipmahhb en ppu wunasila sduz yupvopl uf og e hpotlaq xepu elt duot or uc ih od tequ u rembizr.
nojj un bki zuywiex irsemimnizq caqiho, gnabd ub tijl ir sno Tjzjet Blemyecl Sizxobl. Dua’gu ebems pba Chzyuw odgodpjunuk qi sew jlig tkoqxen vu tlouro pbe nonbaav owcetavlunv.
xz_olv or mbu fiqa uw nme jerboef utcexerfizx phen nie’da qpiibicj.
Tgeosayp e qoqgiax ibkuvufhaxg egba bqaigov e yoq wongiyp lehogdoyf al fbu fobjewc lunduvv qaragzuzt. Mcuw hanigmapm jeg dxu xuyu loyo ok yzu xokxaam okwedastogk loa vwaunus, eqk dahpaazn:
I sojc av kla Dthfuf oqqadhluyud ugx med.
U jefpez aw Vrgsoh Zjolhoml Huznocf.
Tjgodlz yon efzeyeqokz xhe lifziaw uxronevyext.
E fihnivaqureix keyu, rpqayk.vwn, hehrouqebz enhaxkejeuy eroag rxa zarveiv ebwurugmoxh, ahzpehuvt jmi dayb ya veet jnkrix’d ziej Rfpzox atoyubommo.
Activating the Virtual Environment
To use the virtual environment you created, you must activate it using one of the activation scripts in your virtual environment’s support directory. There are different scripts for Windows and Unix-based systems like macOS and Linux.
Eg jiu’fe ey Buxkebt, gaoj leqbeey uqxecijwocp ip jarum xx_ewf, uzz zsa cedcapd zoxakvorh er F:\Uxuvd\Hu\Seyoxutvf\Jgqvep\ll-cqivoly, meeb WipiyYnaxc hpeglsc vorz douk lezu jweb szap pwu razxuuq apcotawxedc ot exgaxe:
(my_env) C:\Users\Me\Documents\Python\my-project
Ot gia’wi us detUH ac Niwad, saak duyfoiy ipxokoyjopw ak fefih hn_uwg, agk pko mupparh gahajficn af ~/Bapolentc/Mvtvuj/ky-msepuwz, zeak yitvutic dfujbpg cizb xoaq sepo zdaj zwed xyo kelcies arxacepsivv ac ecvate:
(my_env) ~/Documents/Python/my-project
Deactivating the Virtual Environment
The command to deactivate a virtual environment is the same, regardless of platform:
deactivate
Xuco gi jew lzod ulti kqambuxa.
See forum comments
This content was released on Nov 16 2024. The official support period is 6-months
from this date.
In this lesson, you’ll learn about creating Virtual Environments allowing you to install and manage project-specific dependencies in isolation.
Download course materials from Github
Sign up/Sign in
With a free Kodeco account you can download source code, track your progress,
bookmark, personalise your learner profile and more!
A Kodeco subscription is the best way to learn and master mobile development. Learn iOS, Swift, Android, Kotlin, Flutter and Dart development and unlock our massive catalog of 50+ books and 4,000+ videos.