📖 ~1 min read
Table of contents
Symptom & Impact
Scripts using /usr/bin/python or python3 resolve to an unexpected version.
Environment & Reproduction
CentOS Stream 9 ships python3.9 as platform-python; alt versions install side by side.
Root Cause Analysis
alternatives manages /usr/bin/python3 -> python3.9 or python3.11.
Quick Triage
alternatives –display python3 shows current link.
Step-by-Step Diagnosis
rpm -qa ‘python3*’ lists installed interpreters.

Solution – Primary Fix
Set the desired default: alternatives –set python3 /usr/bin/python3.11.
Still having issues? Our IT Solutions & Services team can diagnose and resolve this for you. Get in touch for a free consultation.

Solution – Alternative Approaches
Use shebang #!/usr/bin/env python3.11 in scripts that need a specific minor.
Verification & Acceptance Criteria
python3 –version reports the intended interpreter and pip3 matches.
Rollback Plan
alternatives –auto python3 returns to distro default.
Prevention & Hardening
Avoid pip-installing into /usr; use venvs for app dependencies.
Related Errors & Cross-Refs
Related: pip site-packages path drift and dnf python plugin breakage.
Related tutorial: View the step-by-step tutorial for centos-stream-9.
View all centos-stream-9 tutorials on the Tutorials Hub →
Browse all common problems & solutions on the Tutorials Hub.
References & Further Reading
Red Hat ‘Installing and using Python’ chapter.
Need Expert Help?
If you cannot resolve this yourself, our team offers hands-on Server Management, Managed IT Services, and flexible Support Plans. Contact us today — we respond within one business day.