0

I have a Raspberry Pi 4 running Raspbian 10. I've been trying to update the version of Python 3 that is installed so I can run Home Assistant which required 3.9.0, but it's all gone a bit pear shaped. The Pi runs a couple of other things so I'm doing a manual install instead of using the bundled Home Assistant OS.

I did have Python 3.7.3 installed. I then installed 3.9.0 apparently successfully. However running python3 --version was still reporting 3.7.3. After a bit of Googling I managed to get the python --version command to show 3.9.0. But python3 stubbornly continues to report 3.7.3. How do I get python3 --version to report 3.9.0 instead of 3.7.3?

I've also tried installing Python 3.9.13, but that errors out so I've abandoned that for now.

I have run sudo apt update and sudo apt upgrade, so everything is as up to date as it can be.

BTW, I know very little about Linux, so I know I could have easily screwed things up.

Slugsie
  • 851
  • 1
  • 7
  • 17
  • How did you install 3.9.0? – Samathingamajig Aug 22 '22 at 17:33
  • I basically followed the guide here https://itheo.tech/install-python-39-on-raspberry-pi – Slugsie Aug 22 '22 at 17:40
  • Every version of python is generally self contained for different use cases. if you look at `which python3` and `which python` they point to different directories and instances of Python. You need to make sure you update the correct instance. – Fallenreaper Aug 22 '22 at 17:40
  • @Fallenreaper OK, but how do I do that? – Slugsie Aug 22 '22 at 17:52
  • DId you follow the steps for ["Make Python 3.9 default on Raspberry Pi"](https://itheo.tech/install-python-39-on-raspberry-pi#:~:text=Make%20Python%203.9%20default%20on%20Raspberry%20Pi) – Samathingamajig Aug 22 '22 at 18:22
  • Depends on what you want to do. If youre trying to use the same instance of python for both ( same folder ) you would want to consider making an `alias` of sorts. If update `python3` to be the same version of `python`, it will still be different installed instances but they would be at the same snapshot. So i think you need to understand what you really want to do and why you want to do it. – Fallenreaper Aug 22 '22 at 20:23
  • @Samathingamajig Yes, that sets the Python command to use 3.9.0 just fine, but Python3 still reports 3.7.3. Home Assistant needs 3.9.0+, and it's reporting that it's found 3.7.3, so I presume that it's using Python3 to version check, hence why I need to figure out how to get Python3 to report 3.9.0. – Slugsie Aug 22 '22 at 20:24
  • @Fallenreaper As I explained originally. I'm trying to get Home Assistant working. It requires Python 3.9.0+. It's detecting that 3.7.3 is installed, presumably because it runs Python3 and gets told 3.7.3. So I need Python3 to report 3.9.0 that 3.9.0 is installed instead. – Slugsie Aug 22 '22 at 20:46
  • Go into your `~` directory, and if you do `ls -al` you may see a .profile or something else. Inside of that command, you should say something like: `alias python3=python39` BUT that would work if python39 is a valid version. That is what I would do. You should see that there may be a lot of different instance of Python installed on a system, organized by version. Terminal and auto complete will give you insights as well. If you find one which points to the correct version you need, update it. Test first to confirm it does work before updating profile – Fallenreaper Aug 23 '22 at 18:37
  • so what i would do is type `python` and then double tab to see all the available options. Then `alias` as needed to update python3 to point to the version you need. – Fallenreaper Aug 23 '22 at 18:39
  • If you run the command `type python3` it will show you exactly what gets run when you invoke `python3`. Change whatever that is so that it points to your 3.9.0 version. – Mark Setchell Aug 24 '22 at 08:05

0 Answers0