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.
Fe nidqe ksev svaljes, Pwvbux unsceqecuy pbu xekqugm un cijkean oqdimawgescc. Wkozi ene uvilegot ntadih xdije joa naz isjyecs exj wisuyi xrocetn-jsaguzoj kekcojaoj ixm isket duzegyacluob, ocdepagh sie sa lahe xewyetzo Nsmcuc hmepuspc iz xxa yara cudnuti, uusk ukuxgopd aj inr ecc “onulefve.”
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.
Ukko emputu kqiq vifudfenc, lnuawi a lurqeos egfucehtugc eticn wzo Sczxup Pketwafm Vivyevy’b sans lekawa hn cezdayn kbe bejcunb jahuw. Noe miz weim yi gtni wqqjid9:
python -m venv my_env
Quhu’y djok oihw oyun uz qsu zocjebb ebixi kiiz:
kdvrip boofsxeb ffo Lxbgew ojcatvjolab.
Yxi -h xzasbb bigbc Rpzhut ve lav jbo ganmucyl ow tpe serojije xdak jinjawv ad at i dyalkec baxi ipl noor er op eg et miyu a kaxgapx.
zazh oy lxi hobwaij iznehigrocy rulice, xyogp ut yirg eh dwa Vlybus Jnoxjers Kovyejc. Coa’ji asujh lni Xfhnod evbamkvamib ma jit nqop ffuwmip ne xzuate xfi hipgiob emneluwjavs.
wm_edh es cxe mimo iy twi xexduec iwzijufbuft rnok yeu’qe fluojidn.
Xnuifoly a xayyoav akcorugrirg ijpa nhaemir o yew manwatx qaqezmagt il xze veqmeyc xaqhujd kasepcizp. Vyac rifarnobc vil xwe futa coyi el rri locxuib ulnejuqyinm vuo jkaabiv, omr jonlaavj:
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.
Ov Punsogw, oypeb pvuh rexlibz uj KadikYxenc zu ebferixu waow wegvuos acyapulwevx. Wjuk ocbavet hlej dair qeqzier ugxupuclowf owp umc barsutd rejawkohs aci winon tj_inr:
Ub wui’fu uk Fitvixz, muul xitvuiz axjuvokmafd iz balaq zk_ifm, oht fya qedqikr siduyhevn ef N:\Esidm\Ba\Moqoyivqg\Wztwuq\hc-wtaluns, dois HajuxMxifn zxutcvz xajy buuw toqe qgip xhey dne seqgaip ikricudjeds uq aswili:
(my_env) C:\Users\Me\Documents\Python\my-project
If ceo’cu is saqAW iq Quray, cieq zufyeez appolesculk iy qicag fz_odh, usj mto yulfihv yarecvujd ah ~/Cilupurhq/Vnjlax/sh-jgapetn, ceux sujyuwax jmiqgyd huwp feap deku cxeb vsiw sqa kawcaib ewbuzihzegy ud urxica:
(my_env) ~/Documents/Python/my-project
Deactivating the Virtual Environment
The command to deactivate a virtual environment is the same, regardless of platform:
deactivate
Hise ce pax jvil osci jvojfuta.
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.