Python 3.7 auto defaulted to Python 2.7.10!

Hi,

I’m using a MacBook Pro (Early 2011) on macOS High Sierra. I’m on Exercise 24. In trying to run the script, f-strings on lines 20 and 24 give me a syntax error. I #line 20 out for testing hence:

LP3THW%20Ex%2024

Everything is correct. I ran python in bash as suggested on a google search and got this:

Python 2.7.10 (default, Oct  6 2017, 22:29:07) 
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.31)] on darwin

I’m not sure how to fix this nor sure of what I did to “break it”. I tried downloading the 3.7 version again but it did nothing after installing it… I found some info on stackflow but the comments are dated (creating an alias?) and I’m not entirely sure which of all the comments made would be the correct approach, please advice. Any all help appreciated. Thanks!

stack overflow link 1
stack overflow link 2

So, if you download the Python 3.7 installer for Mac OSX and then install it, you’ll get 3.7 and the exercises should work. Except! You have to run your scripts using the command python3 or python3.7, so try this:

python3 --version
python3.7 --version

Then use the command that works and prints out that it’s version 3.7. So let’s say you do the first one and you get an error but the 2nd one works, then you can do this:

python3.7 ex20.py

And it should work just fine.

1 Like

Wow. :man_facepalming:

Yes that absolutely worked! It’s ex24.py but still thank you so much! And thank you for replying so promptly! This is one time where going to the internet for “answers” didn’t help, made me think the solution was more complicated… I think if I had just sat on it longer I would’ve picked it out lol. Anyway, looking forward to completing the rest of the exercises :slight_smile:

Thanks again!

Not a problem. Feel free to come back if you have more questions.