Tag Archives: Grammar mistakes

[Python] error syntax error: summary of solutions to invalid syntax

Today, I learned Python, but I had a problem at the beginning. The code was perfectly fine, but every time I ran it, it showed “SyntaxError: Invalid Syntax”.

“SyntaxError: invalid syntax” means “mark> syntax error ;
after query solved the problem, so concluded a solution to this question:

    version problem:
    because python2 and python3 are incompatible, so some can run on python2 code can not run on python3; You can try to change versions; path problem:
    remember to take a closer look at your own path is correct; careless problem: br> f>t to add colon (:) at the end of if, elif, else, for, while, class,def declarations;
    used = instead of ==; When installing third-party modules :
    when installing third-party modules is also likely to be “SyntaxError: invalid syntax” this problem, then need to check some is installed under the CMD window, at the same time, to the python installation directory, find PIP installation directory inside;