SDK Manager changes /usr/bin/python symlink

I found that every time I flash the device, the default Python version got reset to 2.7, which is a little annoying.
I believe this is something to do with

Is it possible that you handle the Python version in the script instead of modifying the symlink on the system?

Thank you.


did you mean python on your host got linked to Python 2 instead of Python 3?
I think we don’t modify it, and that’s overwritten by the python package in Ubuntu repository.

# Some of our tools (notably, boardctl) still require python2. In the past,
# we've installed python2 by installing the "python" package, but as of
# ubuntu 22.04, this package has been obsoleted and is no longer available.
# Instead, we have to install the "python2" package.
if [ "${SYSTEM_VER}" -lt 2204 ]; then
	sudo apt-get install -y python
	sudo apt-get install -y python2

There’s usage of python all over the flashing scripts, so it’s hard to handle all the use case
Also, someone may use python2, whereas someone use python2.7, which further makes things more complicated.

did you mean python on your host got linked to Python 2 instead of Python 3?

Yes, exactly. I did not expect this happening and realized it by an error log of a cron job that relies on Python 3.
It can cause so many issues on Ubuntu 20.04 and later versions and for many people using machine learning libraries.
My suggestion is not to install the “python” package and instead install only the “python2.7” package. That way, we can prevent the symlink from being overwritten.
It should work fine since the shebang in most of the scripts specifies python2 or python3.

Another option would be to show some warning messages when the symlink was changed so that users can notice it.


your request sounds reasonable, and I will check with our team to see if that’s something we should support.

1 Like

Thank you so much.