Python · Python 2 vs Python 3

You run python script.py on a Linux box and it dies on Python-3 syntax, even though you know Python 3 is installed. What's the likely cause and fix?

Answer locked. Get the free KnowCard app to reveal it — plus spaced-repetition review so it actually sticks.

Get it on App StoreGet it on Google Play

This is one card from the KnowCard library — thousands more across SAP, Linux, Python and more. In the app you get the answer, AI explanations, and cards that come back right before you would forget them. Free to start on iOS, Android or the web.

More in Python 2 vs Python 3

Why is Python 2's input() considered dangerous, and what replaced it?
In Python 3, what does the built-in input() return when the user types 2**5?
What does this print in Python 3? ``` print 5 / 2 ```
In Python 3, what does this evaluate to? ``` 5 / 2 ```
In Python 3, what is the result of each? ``` 10 // 4 10.0 // 4 ```
In Python 3, what does -7 // 2 evaluate to?

Start learning today

Free to start — download the app or use it in your browser.

Get it on App StoreGet it on Google Play