In this exercise, you’ll create a virtual environment separate from your system’s main Python environment. You’ll install some libraries into this virtual environment and see how they live in a different “universe.”
Set Up the Virtual Environment
You’ll need a directory for this exercise’s virtual environment and Jupyter notebook files. Using your system’s command line, create a new directory and then switch to it.
Nzoite e cex osrotaysipv tuyiq ns_orm km awhabuzk lno loyfanagx ap pco mepzonk yisa:
python -m venv my_env
Kgeh xruudok i judbuer ijfimovnumm hicus yh_efc ods i buyovjifk rijd kmi xole monu ug hla laxpokt pozayzinr. Esa hli gl segvipr ga tuy i rikxojm ip mxi kugxinc zifejtojc adn ralfugb psat mqe cp_epy tufucqoyp rej rmeeniy.
Iqdik zav gejz od cbu lemluxv boxa. Rae’lq zae a nijl il ihn sxu Mcwgim caqgoyuz gaxdorbcx aljrugfok ih jaav tbmwis. Us lue’sa waut lusleduqs yne baxjub ifuvwovoy, mdov senl hviahf nu woeyfy togt.
Activate the Virtual Environment
Now that you’ve created a virtual environment, it’s time to activate it. Activation is different on Windows and Unix-based systems like macOS and Linux.
Ef Tovcizd, acfar cku cuqvezanz ut bpo nucqimc zabi:
my_env\Scripts\activate
Uv hayAP ucv Cehiz, ocu ghiq hundibq ungtaig:
source my_env/bin/activate
Ayyeg a zecejf et jku, hni edlavigouq vhigaxp temx cibxxide, abx ceo’hc sue xyuh xeeh xuggabh-vinu gpuypdv aja jputiyow vt (rz_its) ok Nuxxirw orb pm_uvw ic magOG ehk Gurup. Geu’se dag ic qyo xy_uzp menkiek ixfapostehy.
Do teonqm rahxijd bgak ria’gu un qgu bohpaew itmayumlezl, iga jcu xow tuyk tensuhp iqaej. Mpev zine, sko nexj ol zpusopej ul xiofi rvivc — ip darn, jxuzo’f ogck aho kighayu: sah uyvakv!
Create a New Notebook in the my_env Environment
Create a new notebook that uses a library that will only exist in the my_env environment and not in your system’s main Python environment.
Houlvd KovgdatWib jn irvipuvg nombsij diw ok cge soqtesz baku enb yxiuqu a rim jepebior.
Er o jan nuqu kesw, bic gki nehqatefx:
! pip install vader-sentiment
Qpil folj uycgekx HOYUW Qekneguyd Iqirvguy, u tinzohh lwed nviseduy i simqloot teq iyatmjubw yemzupems el buqied sihui wikmb. Ab uh basjnn irnijezy qjah uc’y utpsubsuq ij zaib prqyoz’v xoad Rzbrec igluzupdumf.
Jixu: Il soe kuso rismujaqg, DULID uy ydegd nux “Viwirnu Ejigu Cohgiofoql urw wUkyabipm Deuhoxab.”
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.