5

what is best-practice for changing the default global python interpreter on my fresh debian-based linux node to python3.x?

When I create a fresh Debian or Ubuntu VM, one of the first things I do is use apt to install python3-dev & python3-pip, and sometimes either echo "alias python=python3" >> ~/.bashrc so I don't need to do it again, or even sudo su && echo "alias python=python3" >> /etc/profile.d/00-aliases.sh && exit when I need to make a daemon user like /home/SQLserviceacct/ or /home/Neo4jworker/.

The result is often havoc for potential programs or humans who make shell calls to python and then use any other default python-related environment variables. When things like $PYTHONPATH get assigned out of context, problems arise. I think virtualenvis probably involved somehow.

3

1 Answer 1

1

One possibility would be to link /usr/bin/python to /usr/bin/python3, this way the change will be system wide:

ln -s /usr/bin/python3 /usr/bin/python

2
  • I HATE PYTHON MORE THAN WORDS CAN DESCRIBE IT IS SUCH A PIECE OF **** THANKS THIS IS THE ONLY ANSWER THAT WORKS
    – Anthony
    Apr 5, 2022 at 21:13
  • @Anthony that's not an issue with python, but with your installation/system setup.
    – Panki
    Apr 6, 2022 at 16:47

Not the answer you're looking for? Browse other questions tagged .