QuestionQ520

Software Development and Design

Question Image

Refer to the exhibit. A developer has just completed testing a Python script and wants to save the list of packages and versions installed on the current machine. The developer must ensure that testing it on another device will not cause issues because of differing library versions. Which line of code should be placed where the snippet is missing?

  • A pip freeze 2> requirements.txt
  • B pip freeze > requirements.txt
  • C pip freeze => requirements.txt
  • D pip freeze | requirements.txt
Explanation

pip freeze outputs installed Python packages with their pinned versions. Redirecting standard output with > stores that list in requirements.txt, allowing the same dependency versions to be installed on another device.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!