Bird
0
0

You want to ensure your shell environment always uses Python 3.12 from $HOME/python3.12/bin before any system Python. How should you modify your .bashrc to achieve this?

hard📝 Application Q9 of 15
Linux CLI - Environment and Configuration
You want to ensure your shell environment always uses Python 3.12 from $HOME/python3.12/bin before any system Python. How should you modify your .bashrc to achieve this?
Aexport PATH="$HOME/python3.12/bin:$PATH"
Bexport PATH="$PATH:$HOME/python3.12/bin"
Calias python="$HOME/python3.12/bin/python3"
Dset PATH="$HOME/python3.12/bin:$PATH"
Step-by-Step Solution
Solution:
  1. Step 1: Understand PATH priority

    Paths at the start of PATH variable have higher priority when searching commands.
  2. Step 2: Prepend custom Python path

    Prepending $HOME/python3.12/bin ensures this Python is found first.
  3. Step 3: Check syntax correctness

    Only export PATH="$HOME/python3.12/bin:$PATH" correctly prepends and exports PATH.
  4. Final Answer:

    export PATH="$HOME/python3.12/bin:$PATH" -> Option A
  5. Quick Check:

    Prepend custom path with export PATH [OK]
Quick Trick: Prepend custom bin to PATH with export [OK]
Common Mistakes:
  • Appending path instead of prepending
  • Using alias instead of PATH modification
  • Using 'set' which is invalid in bash

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes