I am a newb to python
. I am running a script I got on the web :
python file.py
I get this :
File "file.py", line 293
print json.dumps(evaluate(), indent=4)
^
SyntaxError: invalid syntax
I read it is related to python version, that should be some 2.7
. So I downloaded pyenv
. And I set the right version in the directory that contains file.py
: pyenv local 2.7.10
. But I still get the same error.
(For information, I am trying to install blockchain
tool : ethereum)
#!/usr/bin/python
in it (the "shebang")? I don't usepyenv
so can't say much about it. How about writing an experimental script that uses that same "shebang" (if present) and then just doesimport sys;print(sys.version)
to make something easier to experiment with. – Forgiven#!/usr/bin/python
and indeed I found this :3.5.0 |Anaconda 2.4.0
. I don't know how to get rid of that - do you have any idea ? – Sweltering/usr/bin/python
is usually python 2, which is what you want for the old style print statement (print something
as opposed toprint(something)
). Python 3 usually shows up as/usr/bin/python3
. What doeswhich python
say? I'm not familiar withanacoda
either and it may have something else in the path. – Forgivenwhich python
outputs/myhome/anaconda/bin/python
– SwelteringPATH
that was set to some path related toanaconda
– Sweltering./file.py
may work also (it may need achmod u+x file.py
). – Forgiven