DevNet Associate DEVASC 200-901 Official Certification Guide by Adrian Iliesiu (z-lib.org)

(andrew) #1
C:\py -3 -m venv myvenv
C:\myvenv\Scripts\activate.bat

At this point, you will see your virtual environment name
in parentheses at the beginning of your command
prompt:


(myvenv)$

This indicates that you are running Python in your
virtual environment. If you close the terminal, you have
to reactivate the virtual environment if you want to run
the code or add modules via pip (the Python module
package manager).


To turn off the virtual environment, just type deactivate
at the command prompt, and your normal command
prompt returns, indicating that you are using your local
system Python setup and not the virtual environment.


To install new modules for Python, you use pip, which
pulls modules down from the PyPI repository. The
command to load new modules is as follows:


pip install packagename

where packagename is the name of the package or
module you want to install. You can go to pypi.org and
search for interesting modules and check to see what
others are using. There are more than 200,000 projects
in the PyPI repository, so you are sure to find quite a few
useful modules to experiment with. These modules
extend Python functionality and contribute to its
flexibility and heavy use today.


The pip command also offers a search function that
allows you to query the package index:


pip search "search value"
Free download pdf