PCAP pip Practice Question
A Python script uses a third-party library 'requests'. The developer wants to ensure that the exact version 2.25.1 is installed in the project's environment. Which tool and command should be used?
⚠ Common exam trap
A common pitfall is assuming that `pip3` is incorrect or non-standard. In reality, both `pip` and `pip3` are valid commands for Python 3 environments; the key is the version-pinning syntax (`==`). The question tests whether the candidate recognizes the correct syntax for specifying an exact version, not the distinction between `pip` and `pip3`.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
pip install requests==2.25.1
Both options B and C are correct because they use the standard pip syntax for pinning a specific version: `package==version`. The command `pip install requests==2.25.1` (B) works on systems where `pip` is linked to Python 3, while `pip3 install requests==2.25.1` (C) explicitly invokes the Python 3 version of pip. Both achieve the same result—installing requests exactly version 2.25.1. Option A fails to specify a version, and option D contains a typo ('instll') that will fail.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
pip install requests
Why it's wrong here
This command omits any version specifier, so pip automatically resolves and installs the latest stable release of requests that satisfies the project's dependency constraints, which will not be 2.25.1 if a newer version exists. The resulting environment is not reproducible because a later invocation could pull a different release, and API or behavior changes in that newer version may break the code. Thus it does not fulfill the requirement to install the specified version.
- ✓
pip install requests==2.25.1
Why this is correct
This command correctly uses the pip package manager with an explicit version specifier. The == operator, an exact version pin defined by PEP 440, tells pip to install precisely requests 2.25.1 from PyPI, bypassing any newer or older release. This ensures reproducible dependency behavior across different machines and deployment stages.
- ✓
pip3 install requests==2.25.1
Why this is correct
This command achieves the same result as the pip-equivalent but explicitly invokes the pip3 entry point, which is associated with the Python 3 interpreter on systems that also have Python 2. The exact version specifier ==2.25.1 remains intact, so pip3 downloads and installs precisely that release into the Python 3 environment. It is a correct, often more explicit alternative on older distributions where the unqualified pip might still point to Python 2.
- ✗
pip instll requests==2.25.1
Why it's wrong here
This command is invalid because of the typo 'instll' instead of 'install'. The operating system's shell will attempt to execute a nonexistent 'pip instll' binary, producing a 'command not found' error before any package resolution can happen. As a result, requests is not installed at all, and the intended version 2.25.1 is never fetched.
Visual reference
Go deeper
Related to this question
About these practice questions
This PCAP question is part of Courseiva's 169-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This PCAP practice question is part of Courseiva's free Python Institute certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the PCAP exam.