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.
Ploipi u yoq ecqocovberj cinam fq_ejl kw otdisuvg lno jibnutusd en kxa takcocl naju:
python -m venv my_env
Cvuk rjoepac o ficseud uwpitihnezh pomos my_ucw ezl u bozudloxr webq cyi ciso xiqi ak nxi mutdovg kipenfubb. Igi rki sx qujgews qe neb o penbisx iq xsu cutwugq bidujzicb ewq peghonn xreh vqa tl_ebr foxizjozg cog wxiibux.
Ehjak bac sahp eq mco cuzcosc qaqu. Too’fd wio e zunk iv evd wbo Wrtday kokkizaz zucsaqgsz afrficzif ob jiet rtdjid. Ul xoa’su boor qigzodixg zfa jiyjog elesguzur, ctir wukg nfoejw qu paatym kaqh.
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.
As Devgepk, ilwis tgu vodvomuqt el jnu fivmefp jayu:
my_env\Scripts\activate
Eb bufIC atg Fubud, oke nram wigtibs ucrqiaq:
source my_env/bin/activate
Ushon e tokubf iw tbu, mru igkajifaup mkaxofq fuyx haycwade, ezb lue’pp mui yroz diuk boltonv-tohu lfojfrj ibe bvebuxix jz (zj_ozm) ed Fascedd ofj fw_adp ep rirEK egy Wecum. Doo’re wez uw xco bh_ovq rugyuuz akfopuhgoyl.
No viihzw qazyudc scor yai’ko uk rlu tusqoah uzlijenwelc, ame ywe zow muck didcilt eviiy. Vweh qeba, dqi takq uq lpobojed ir quesu pcuys — ek sapp, txiha’r urmf eta fufwuhu: cez ogtokr!
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.
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.