This lesson is part of the Network Testing with Pytest course.
In this lesson, you will learn:
- How to install Pytest in a virtual environment.
Note: The steps in this lesson are also included in the next lesson, where we install the hands-on environment for this course. In other words, this lesson is for anyone wanting to install Pytest on its own. Therefore, feel free to move directly to the next lesson by clicking next.
Create Virtual Environment
Before installing Pytest, we will create a virtual environment in which we will install Pytest. By installing Pytest within a virtual environment, we can ensure it (and all of its dependencies) are isolated from any other Python packages installed on the system.
# Create a new venv directory mkdir venv # Create a virtual environment python3 -m venv venv/venv-pytest # Activate the virtual environment source venv/venv-pytest/bin/activate
Now we are inside our newly created virtual environment, we can install Pytest. Like so:
$ pip3 install pytest