1

I am currently able to run .py python scripts from a terminal due, I believe, to this inclusion in my .profile file:

export PYTHONPATH=/home/myplace/python

python being the directory where I put all my home rolled scripts. The thing is that the default interpreter is python 2 and I'd like to be able to run python 3 scripts the same way. Is there a way to indicate in a .py script which interpreter to use? I've seen ample warnings against changing the default interpreter and it's not something I want to do anyway.

TIA

1 Answers1

2

And to answer my own question for the benefit of anybody else barking up the wrong tree, it's a simple matter of putting the location of the interpreter in a shebang at the top of the script:

#! /opt/python3/bin/python3.x

or some such depending on your particular installation.